Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { shellSync } = require('execa')
- const config = require('../../src/config/config')
- const { password, username } = config.databases.sql
- const dbName = 'my_db_name' // this DB will get migrated
- const dumpFileName = 'my_db_dump.sql'
- const shellSyncWithStdio = shCommand =>
- shellSync(shCommand, { stdio: 'inherit' })
- shellSyncWithStdio(
- `mysql -u ${username} -p${password} ${dbName} < ${dumpFileName}`
- )
- shellSyncWithStdio(`cd ../.. && npm run migrate`)
- shellSyncWithStdio(
- `mysqldump -u ${username} -p${password} ${dbName} --skip-comments > ${dumpFileName}`
- )
Add Comment
Please, Sign In to add comment