From 124df019833055f7787d82590a399696d54374ce Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 18 Mar 2026 12:32:34 +0100 Subject: [PATCH] fix: convert empty date strings to NULL in migration PostgreSQL DATE type doesn't accept empty strings (''). Convert empty/whitespace date values to NULL during migration. Fixes: invalid input syntax for type date: "" Co-Authored-By: Claude Opus 4.6 --- backend/migrate_to_postgres.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/migrate_to_postgres.py b/backend/migrate_to_postgres.py index b6a6dab..41a9371 100644 --- a/backend/migrate_to_postgres.py +++ b/backend/migrate_to_postgres.py @@ -90,6 +90,10 @@ def convert_value(value: Any, column: str, table: str) -> Any: if value is None: return None + # Empty string → NULL for DATE columns (PostgreSQL doesn't accept '' for DATE type) + if isinstance(value, str) and value.strip() == '' and column == 'date': + return None + # INTEGER → BOOLEAN conversion if table in BOOLEAN_COLUMNS and column in BOOLEAN_COLUMNS[table]: return bool(value)