How to use it
- 1Export your database (sqlite3 app.db .dump) and paste the SQL, or drop the .sql file.
- 2Read the review notes under the output — they list everything that needs a human decision.
- 3Download the PostgreSQL script and run it against a staging database first.
What changes between SQLite and PostgreSQL
INTEGER PRIMARY KEY AUTOINCREMENT becomes BIGINT GENERATED BY DEFAULT AS IDENTITY, with a setval() call appended so new rows don't collide with imported ids.
BOOLEAN columns get real TRUE/FALSE values instead of 1/0, DATETIME becomes TIMESTAMP and BLOB becomes BYTEA.
PRAGMA and sqlite_sequence statements are removed, and index names are prefixed with the table name to keep them unique within the schema.
What to check before you run it
Run the converted script against an empty staging database first, inside a transaction if the target supports transactional DDL. The review notes under the output list every statement that was dropped, every type with no direct equivalent and every clause that needs a manual decision.
Views, triggers, stored procedures and functions are passed through unchanged and flagged. Their bodies are written in SQLite's procedural language and need a human rewrite for PostgreSQL.
After loading, compare row counts table by table. For a deeper check, export a table from both databases and run the two files through the CSV compare tool.
Questions
SQLite let me store anything in any column. Will PostgreSQL accept it?
Not always. PostgreSQL enforces types, so text stored in an INTEGER column or an invalid date will be rejected on import. Run the script inside a transaction and fix the rows it reports.