new app store links feature
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
+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}")
|
||||
|
||||
@@ -98,6 +98,11 @@ class StationConfig(Base):
|
||||
stream_url = Column(String(500), nullable=False, default="")
|
||||
stream_metadata_url = Column(String(500), nullable=False, default="")
|
||||
|
||||
# Mobile app download links
|
||||
play_store_icon_url = Column(String(500), nullable=False, default="")
|
||||
play_store_url = Column(String(500), nullable=False, default="")
|
||||
app_store_embed_html = Column(Text, nullable=False, default="")
|
||||
|
||||
|
||||
class HistoryEntry(Base):
|
||||
__tablename__ = "history_entries"
|
||||
|
||||
@@ -75,6 +75,9 @@ class StationConfigResponse(BaseModel):
|
||||
donation_url: str
|
||||
stream_url: str
|
||||
stream_metadata_url: str
|
||||
play_store_icon_url: str
|
||||
play_store_url: str
|
||||
app_store_embed_html: str
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
@@ -99,6 +102,9 @@ class StationConfigUpdate(BaseModel):
|
||||
donation_url: Optional[str] = None
|
||||
stream_url: Optional[str] = None
|
||||
stream_metadata_url: Optional[str] = None
|
||||
play_store_icon_url: Optional[str] = None
|
||||
play_store_url: Optional[str] = None
|
||||
app_store_embed_html: Optional[str] = None
|
||||
|
||||
|
||||
# ── HistoryEntry ──────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user