Fix migration script: cast SQLite integer booleans to Postgres booleans #81
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/pal-e-api#81
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plan
plan-2026-02-26-tf-modularize-postgres-- Phase 3, Part D (data migration script)Repo
forgejo_admin/pal-e-docsUser Story
As a platform operator
I want the SQLite-to-Postgres migration script to handle boolean type differences
So that data migrates cleanly without manual intervention
Context
SQLite stores booleans as integers (
1/0). Postgres expects actual booleans (true/false). The migration script (scripts/migrate_sqlite_to_postgres.py) does rawINSERTviatext()SQL without type conversion, causingDatatypeMismatchon boolean columns.Error:
column "is_public" is of type boolean but expression is of type integerThree boolean columns in the schema:
notes.is_publicprojects.is_publicusers.is_approvedFile Targets
Files the agent should modify:
scripts/migrate_sqlite_to_postgres.py-- add boolean conversion for affected columnsFiles the agent should NOT touch:
Acceptance Criteria
1/0to PythonTrue/Falsefor boolean columns before inserting into PostgresNonevalues in boolean columns should stayNone(if nullable)Test Expectations
kubectl port-forward -n postgres svc/pal-e-postgres-rw 5432:5432 &PALDOCS_DATABASE_PATH=/tmp/pal-e-docs-backup.db PALDOCS_DATABASE_URL=postgresql://paledocs:PfyJMdX4mPJF8eyYS38l@127.0.0.1:5432/paledocs .venv/bin/python scripts/migrate_sqlite_to_postgres.pyPALDOCS_DATABASE_URL=... alembic downgrade base && alembic upgrade head(clean schema)Constraints
row_dictsbefore insertionbool()conversion or explicit{1: True, 0: False}mappingChecklist
Related
plan-2026-02-26-tf-modularize-postgresPhase 3 — this blocks data migration