fixes db init for production
This commit is contained in:
Binary file not shown.
Binary file not shown.
+3
-3
@@ -88,17 +88,17 @@ def _migrate_add_missing_columns(sync_conn):
|
|||||||
if isinstance(col_type, sa.Text):
|
if isinstance(col_type, sa.Text):
|
||||||
sql_type = "TEXT"
|
sql_type = "TEXT"
|
||||||
elif isinstance(col_type, sa.String):
|
elif isinstance(col_type, sa.String):
|
||||||
sql_type = "VARCHAR(500)"
|
sql_type = f"VARCHAR({col_type.length})"
|
||||||
else:
|
else:
|
||||||
sql_type = "TEXT"
|
sql_type = "TEXT"
|
||||||
|
|
||||||
if dialect == "sqlite":
|
if dialect == "sqlite":
|
||||||
sync_conn.execute(
|
sync_conn.execute(
|
||||||
sa.text(f'ALTER TABLE {table_name} ADD COLUMN "{col_name}" TEXT NOT NULL DEFAULT "{default}"')
|
sa.text(f"ALTER TABLE {table_name} ADD COLUMN \"{col_name}\" TEXT NOT NULL DEFAULT '{default}'")
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
sync_conn.execute(
|
sync_conn.execute(
|
||||||
sa.text(f'ALTER TABLE {table_name} ADD COLUMN "{col_name}" {sql_type} NOT NULL DEFAULT "{default}"')
|
sa.text(f"ALTER TABLE {table_name} ADD COLUMN \"{col_name}\" {sql_type} NOT NULL DEFAULT '{default}'")
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f" ✓ Added {table_name}.{col_name}")
|
print(f" ✓ Added {table_name}.{col_name}")
|
||||||
|
|||||||
Reference in New Issue
Block a user