Migrate data from sqlite3 to Postgres
I have a database in sqlite3 and now I want to move data to Postgres, here are the steps I did:
Create all table in sqlite3 to Postgres
- Run
sqlite3 dbfile.db
.schema
- Copy the tables, indies, the triggers to Postgres
- Convert data type in sqlite3 to Postgres
- Now we have a schema in Postgres
- Run
Export data in sqlite3 to csv
.mode csv
.once 'table.csv'
select * from table;
- Now we have csv file contain data for table. It place in where we run command
Import data from CSV in Postgres tool
- I use the tool Pgadmin
- Redo for other tables
Done.