imapsql: SQLite to PostgreSQL migration #837
foxcpp
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Not adding this to maddy.email documentation since this is not really officially supported (yet). This involves some careful regex editing in the dump file.
INTEGER ... AUTOINCREMENTshould beBIGSERIALin PostgreSQL.Open SQL dump with text editor.
2.1. Remove
PRAGMA foreign_keys=OFF.2.2. Update
users.iddefinition:should become
2.3. Do the same for
CREATE TABLE mboxes(mboxes.id need fixing)2.4. LONGTEXT type should be BYTEA. Find&Replace will do just fine.
SQLite writes hex-encoded blobs as
X'data', PostgreSQL uses'\xdata'.This works fine:
Remove anything that mentions sqlite_schema, sqlite_stat1. These are SQLite internals and are not relevant.
Convert sqlite_sequence into PostgreSQL sequences.
Somewhere near the end of dump, you will find this:
You should replace these with corresponding ALTER SEQUENCE commands, like this:
Beta Was this translation helpful? Give feedback.
All reactions