Migrating from sqlite3 to postgresql in development

9:53 PM September 10 2025 Code

I wanted to migrate from SQLite3 to PostgreSQL in one of my side projects to play with pgvector and a few ideas that I had for this small app.

I did the .dump file with this oneliner:

sqlite3 db/development.sqlite3 .dump > dump.sql

Then I used pgloader to adjust any specific sqlite syntax to play with postgres. I choose to run it with docker because it seemed the quickest choice.

docker run --rm -it \
  --network="host" \
  -v /home/your-user/code/your-app/storage:/data \
  dimitri/pgloader:latest \
  pgloader sqlite:///data/development.sqlite3 postgresql://postgres@localhost:5432/projectdev

--network="host" tells Docker container to share the host’s network stack -> localhost points to your machine (I have postgres running in another docker container)

And that was it! now I am going to continue with my experiment, and I will write about it soon too.