Migration tool from PostgreSQL to SQLite for Dnote.
This tool migrates data from Dnote server v2.x (PostgreSQL) to Dnote server v3 (SQLite).
- You must be running Dnote server v2.x
Download pre-built binaries from the releases page.
go install github.com/dnote/dnote-pg2sqlite@latest
git clone https://github.com/dnote/dnote-pg2sqlite.git
cd dnote-pg2sqlite
make build
dnote-pg2sqlite \
--pg-host localhost \
--pg-port 5432 \
--pg-database dnote \
--pg-user dnote \
--pg-password yourpassword \
--sqlite-path ~/.local/share/dnote/server.db
Note: Dnote v3 uses XDG directories. The default SQLite database path is ~/.local/share/dnote/server.db
(or $XDG_DATA_HOME/dnote/server.db
).
Safety: The migration tool will refuse to run if the SQLite file already exists, preventing accidental overwrites. Remove the existing file if you need to re-run the migration.
Always backup PostgreSQL before migrating:
pg_dump -h localhost -U dnote -d dnote > dnote_backup.sql
- Users & accounts
- Books & notes
- Sessions & tokens
Full-text search index rebuilds automatically.
- Ensure you're on v2.x: Upgrade to Dnote server v2.x if needed
- Stop your Dnote server to ensure data consistency during migration
- Backup your PostgreSQL database (see above)
- Run the migration tool with your PostgreSQL credentials
- Verify the migration succeeded (check record counts)
- Upgrade to Dnote v3 and configure it to use the new SQLite database
After migration:
- Check the tool's output for record counts
- Start Dnote v3 and verify login works