Skip to content

Instantly share code, notes, and snippets.

@morungos
Created November 13, 2018 16:20
Show Gist options
  • Save morungos/c12d2c1e0f11238f505b664d8048bedf to your computer and use it in GitHub Desktop.
Save morungos/c12d2c1e0f11238f505b664d8048bedf to your computer and use it in GitHub Desktop.
Stuart's script for grabbing MySQL data over ssh and dumping into sqlite3
ssh aps1.cluster.turalt.com mysqldump --complete-insert --compatible=ansi --no-create-db --no-create-info --ignore-table=turalt.knex_migrations --ignore-table=turalt.knex_migrations_lock --skip-opt -uturalt -pturalt turalt | sed -e 's/\\\"/"/g' | sed -e "s/\\\'/''/g" > ~/compatible-ansi.sql
rm dev.sqlite3
npx knex migrate:latest
sqlite3 dev.sqlite3
sqlite> begin transaction;
sqlite> .read /Users/stuart/compatible-ansi.sql
sqlite> commit;
sqlite> .quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment