fix: convert empty date strings to NULL in migration
All checks were successful
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s

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 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-03-18 12:32:34 +01:00
parent 7758bbf12e
commit 124df01983

View File

@ -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)