You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

FileSender supports several different database back-ends, by virtue of PHP's PDO.

Currently there are 3 back-ends that are known to work: Postgres, 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

 

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

 

Postgres to SQLite

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" |
sqlite3 filesender.sqlite

 

SQLite to MySQL

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
  • No labels