migrate_carousel_desc.py 444 B

123456789101112131415
  1. from app import create_app, db
  2. from sqlalchemy import text
  3. app = create_app()
  4. with app.app_context():
  5. print("Adding description column to carousel table...")
  6. try:
  7. db.session.execute(text('ALTER TABLE carousel ADD COLUMN description VARCHAR(256);'))
  8. print("Added description")
  9. except Exception as e:
  10. print("description might already exist:", e)
  11. db.session.commit()
  12. print("Migration completed.")