Spaces:
Sleeping
Sleeping
axeronis commited on
Commit ·
64438b2
1
Parent(s): 960cd60
fix: use IF NOT EXISTS for landing_config table migration
Browse files
backend/alembic/versions/2025_12_26_landing_config.py
CHANGED
|
@@ -20,19 +20,22 @@ depends_on: Union[str, Sequence[str], None] = None
|
|
| 20 |
|
| 21 |
|
| 22 |
def upgrade() -> None:
|
| 23 |
-
"""Create landing_config table."""
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
def downgrade() -> None:
|
| 37 |
"""Drop landing_config table."""
|
| 38 |
op.drop_table('landing_config')
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
def upgrade() -> None:
|
| 23 |
+
"""Create landing_config table if it doesn't exist."""
|
| 24 |
+
# Use raw SQL with IF NOT EXISTS to handle table already existing
|
| 25 |
+
op.execute("""
|
| 26 |
+
CREATE TABLE IF NOT EXISTS landing_config (
|
| 27 |
+
id UUID NOT NULL PRIMARY KEY,
|
| 28 |
+
trust_logos JSON,
|
| 29 |
+
hero_title VARCHAR,
|
| 30 |
+
hero_subtitle VARCHAR,
|
| 31 |
+
show_chat_demo BOOLEAN NOT NULL DEFAULT true,
|
| 32 |
+
show_pricing BOOLEAN NOT NULL DEFAULT true,
|
| 33 |
+
updated_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now()
|
| 34 |
+
)
|
| 35 |
+
""")
|
| 36 |
|
| 37 |
|
| 38 |
def downgrade() -> None:
|
| 39 |
"""Drop landing_config table."""
|
| 40 |
op.drop_table('landing_config')
|
| 41 |
+
|