Versions Compared

Key

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

...

Currently there are 3 back-ends that are known to work: PostgresPostgreSQL, MySQL, and SQLite.

Assumptions:

  • 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

Postgres to MySQL

 

Code Block
themeMidnight
languagebash
pg_dump -U username -h hostname -a --inserts filesender |
sed -r 's/^(INSERT\ INTO\ )(files|logs)(\ VALUES\ )/\1`\2`\3/g' |
grep --color=never "^INSERT INTO" |
mysql -u username -h hostname -p filesender

 

...

PostgreSQL to SQLite

Code Block
themeMidnight
languagebash
pg_dump -U username -h hostname -a --inserts filesender |
sedgrep -r 's/^(INSERT\ INTO\ )(files|logs)(\ VALUES\ )/\1`\2`\3/g'-color=never "^INSERT INTO" |
sqlite3 filesender.sqlite

 

 

SQLite to PostgreSQL

Code Block
themeMidnight
languagebash
sqlite3 filesender.sqlite |
grep -E --color=never "^INSERT\ INTO\ \"(logs|files)\" VALUES" |
sqlite3psql -U username -h hostname filesender.sqlite

 

 SQLite

SQLite to MySQL

Code Block
themeMidnight
languagebash
sqlite3 filesender.sqlite .dump |
sed -r 's/^(INSERT\ INTO\ )"(logs|files)"(\ VALUES)/\1`\2`\3/g' |
grep --color=never "^INSERT INTO \`" |
mysql -u username -h hostname -p filesender

 

 

MySQL to PostgreSQL

Code Block
themeMidnight
languagebash
asdf

 

 

MySQL to SQLite

Code Block
themeMidnight
languagebash
asdfasd