mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-05-20 06:34:40 +02:00
fix(google_places): add schema migration for Google columns
The place_cache table was missing google_place_id, google_data, and google_fetched_at columns needed by the Google Places enrichment. Adds ALTER TABLE migration in _get_db() to add columns if missing, wrapped in try/except to handle existing columns gracefully. Fixes HTTP 500 on /api/place/W/* endpoints.
This commit is contained in:
parent
bb7d0169e0
commit
1b3ad1bf9e
1 changed files with 12 additions and 0 deletions
|
|
@ -47,6 +47,18 @@ def _get_db():
|
|||
)
|
||||
""")
|
||||
_db_conn.commit()
|
||||
# Schema migration: add Google columns to place_cache if missing
|
||||
for col, coldef in [
|
||||
('google_place_id', 'TEXT'),
|
||||
('google_data', 'TEXT'),
|
||||
('google_fetched_at', 'INTEGER'),
|
||||
]:
|
||||
try:
|
||||
_db_conn.execute(f'ALTER TABLE place_cache ADD COLUMN {col} {coldef}')
|
||||
logger.info(f'Added column {col} to place_cache')
|
||||
except sqlite3.OperationalError:
|
||||
pass # Column already exists
|
||||
_db_conn.commit()
|
||||
return _db_conn
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue