Guest User

Untitled

a guest
Dec 14th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. const { shellSync } = require('execa')
  2.  
  3. const config = require('../../src/config/config')
  4. const { password, username } = config.databases.sql
  5. const dbName = 'my_db_name' // this DB will get migrated
  6. const dumpFileName = 'my_db_dump.sql'
  7. const shellSyncWithStdio = shCommand =>
  8. shellSync(shCommand, { stdio: 'inherit' })
  9.  
  10. shellSyncWithStdio(
  11. `mysql -u ${username} -p${password} ${dbName} < ${dumpFileName}`
  12. )
  13. shellSyncWithStdio(`cd ../.. && npm run migrate`)
  14. shellSyncWithStdio(
  15. `mysqldump -u ${username} -p${password} ${dbName} --skip-comments > ${dumpFileName}`
  16. )
Add Comment
Please, Sign In to add comment