Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b789c1bd44 | ||
|
|
5062aa8068 | ||
|
|
8a042589e7 | ||
|
|
3898b5ad45 | ||
|
|
9d15336144 |
@@ -69,12 +69,6 @@ BOOLEAN_COLUMNS = {
|
|||||||
'ai_prompts': ['active'],
|
'ai_prompts': ['active'],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Column whitelist for tables that have schema differences
|
|
||||||
# Only these columns will be migrated (filters out legacy columns)
|
|
||||||
COLUMN_WHITELIST = {
|
|
||||||
'ai_insights': ['id', 'profile_id', 'scope', 'content', 'created'],
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# ================================================================
|
# ================================================================
|
||||||
# CONVERSION HELPERS
|
# CONVERSION HELPERS
|
||||||
@@ -179,17 +173,8 @@ def migrate_table(pg_conn, table: str) -> Dict[str, int]:
|
|||||||
# Convert rows
|
# Convert rows
|
||||||
converted_rows = [convert_row(row, table) for row in sqlite_rows]
|
converted_rows = [convert_row(row, table) for row in sqlite_rows]
|
||||||
|
|
||||||
# Get column names - filter if whitelist exists for this table
|
# Get column names
|
||||||
if table in COLUMN_WHITELIST:
|
columns = list(converted_rows[0].keys())
|
||||||
allowed_columns = COLUMN_WHITELIST[table]
|
|
||||||
# Filter rows to only include allowed columns
|
|
||||||
converted_rows = [
|
|
||||||
{k: v for k, v in row.items() if k in allowed_columns}
|
|
||||||
for row in converted_rows
|
|
||||||
]
|
|
||||||
columns = allowed_columns
|
|
||||||
else:
|
|
||||||
columns = list(converted_rows[0].keys())
|
|
||||||
cols_str = ', '.join(columns)
|
cols_str = ', '.join(columns)
|
||||||
placeholders = ', '.join(['%s'] * len(columns))
|
placeholders = ', '.join(['%s'] * len(columns))
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user