Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The target database has the right schema, tables, etc, and is empty. See the create scripts in the scripts/ directory.
  • Both the source and destination database are called filesender
  • SQLite databases are called filesender.sqlite

Postgres to MySQL

Use a shell script that does:

...

Largely the same shell script, but no backticks are needed here,.

This takes a while depending on the amount of records.

Code Block
themeMidnight
languagebash
pg_dump -U username -h hostname -a --inserts filesender |
sed -r '/SET\ ([a-z_]*)\ =\ (.*);/d' |
sed -r '/SELECT\ pg_catalog.setval(.*);/d' |
sqlite3 filesender.sqlite

 

 

SQLite to PostgreSQL

...

Code Block
themeMidnight
languagebash
echo -e ".mode insert files\nSELECT * FROM files;\n.mode insert logs\nSELECT * FROM logs;" |
sqlite filesender.sqlite |
psql -U username -h hostname filesender

...