I have been doing development using SQLITE database with production in POSTGRESQL. I simply up-to-date my local database with a lot of data and want to transfer a particular table towards the production database.
According to running
sqlite database .dump > /the/path/to/sqlite-dumpfile.sql, SQLITE results a table dump within the following format:
BEGIN TRANSACTION; CREATE TABLE "courses_school" ("id" integer PRIMARY KEY, "department_count" integer NOT NULL DEFAULT 0, "the_id" integer UNIQUE, "school_name" varchar(150), "slug" varchar(50)); INSERT INTO "courses_school" VALUES(1,168,213,'TEST Name A',NULL); INSERT INTO "courses_school" VALUES(2,0,656,'TEST Name B',NULL); .... COMMIT;
How do you convert the above mentioned right into a POSTGRESQL compatible dump file will be able to import into my production server?
You need to have the ability to feed that dump file directly into
/path/to/psql -D database -U username -W < /the/path/to/sqlite-dumpfile.sql
If you would like the
id column to "auto increment" then change its type from "int" to "serial" within the table creation line. PostgreSQL will fasten a sequence to that particular column to ensure that Card inserts with NULL ids is going to be instantly designated the following available value.
The syntax within the SQLite dump file seems to become suitable for PostgreSQL. Posting a large pile of information through SQL Card inserts usually takes some time but it'll work.