new app store links feature
This commit is contained in:
+12
-1
@@ -23,6 +23,9 @@ def _migrate_add_missing_columns(sync_conn):
|
||||
pending = [
|
||||
("station_config", "stream_url", sa.String(500), ""),
|
||||
("station_config", "stream_metadata_url", sa.String(500), ""),
|
||||
("station_config", "play_store_icon_url", sa.String(500), ""),
|
||||
("station_config", "play_store_url", sa.String(500), ""),
|
||||
("station_config", "app_store_embed_html", sa.Text, ""),
|
||||
]
|
||||
|
||||
# Determine dialect
|
||||
@@ -38,13 +41,21 @@ def _migrate_add_missing_columns(sync_conn):
|
||||
|
||||
print(f" → Migrating: adding column {table_name}.{col_name}")
|
||||
|
||||
# Determine SQL type from the column type object
|
||||
if isinstance(col_type, sa.Text):
|
||||
sql_type = "TEXT"
|
||||
elif isinstance(col_type, sa.String):
|
||||
sql_type = "VARCHAR(500)"
|
||||
else:
|
||||
sql_type = "TEXT"
|
||||
|
||||
if dialect == "sqlite":
|
||||
sync_conn.execute(
|
||||
sa.text(f'ALTER TABLE {table_name} ADD COLUMN "{col_name}" TEXT NOT NULL DEFAULT "{default}"')
|
||||
)
|
||||
else:
|
||||
sync_conn.execute(
|
||||
sa.text(f'ALTER TABLE {table_name} ADD COLUMN "{col_name}" VARCHAR(500) 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}")
|
||||
|
||||
Reference in New Issue
Block a user