I dump my SQLite database like this:
sqlite3 database.sqlite .dump
And this is the relevant part of the dump:
CREATE TABLE auth_user(
id INTEGER PRIMARY KEY AUTOINCREMENT,
org_id INTEGER,
email CHAR(512) UNIQUE,
user_doc_id CHAR(128),
password CHAR(512),
registration_key CHAR(512),
reset_password_key CHAR(512),
registration_id CHAR(512)
);
And I have to import this to postgres. Postgres does not accept AUTOINCREMENT, but I need a similar functionality. I want to automatically process the SQLite dump in order to import it to postgres. I have read about NEXTVAL and CREATE_SEQUENCE, but I can not automate the conversion using that easily
Is there a simple way of sedding the sqlite dump to feed it to postgres?
Replace
INTEGER PRIMARY KEY AUTOINCREMENTwithSERIAL PRIMARY KEY.Ensure to catch all ways to write it (lowercase, whitespace etc.).