-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_hero_description_to_about.py
More file actions
38 lines (29 loc) · 1.06 KB
/
Copy pathadd_hero_description_to_about.py
File metadata and controls
38 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
"""
Migration script to add hero_description column to about table
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sqlalchemy import create_engine, text
from app.core.config import settings
def add_hero_description_column():
"""Add hero_description column to about table"""
# Create engine
engine = create_engine(settings.DATABASE_URL)
try:
with engine.connect() as connection:
# Add the hero_description column
connection.execute(text("""
ALTER TABLE about
ADD COLUMN IF NOT EXISTS hero_description TEXT;
"""))
# Commit the transaction
connection.commit()
print("✅ Successfully added hero_description column to about table")
except Exception as e:
print(f"❌ Error adding hero_description column: {e}")
finally:
engine.dispose()
if __name__ == "__main__":
add_hero_description_column()