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

    1. Run sqlite3 dbfile.db
    2. .schema
    3. Copy the tables, indies, the triggers to Postgres
    4. Convert data type in sqlite3 to Postgres
    5. Now we have a schema in Postgres
  • Export data in sqlite3 to csv

    1. .mode csv
    2. .once 'table.csv'
    3. select * from table;
    4. Now we have csv file contain data for table. It place in where we run command
  • Import data from CSV in Postgres tool

    1. I use the tool Pgadmin
    2. Redo for other tables


No Comments Yet