1.01-location-to-terminal.js 922 B

1234567891011121314151617181920212223242526
  1. const chalk = require('chalk')
  2. module.exports = {
  3. version: 1.01,
  4. name: 'Location to Terminal',
  5. description: 'Refactors `Location` to `Terminal`',
  6. up: async (queryInterface, Sequelize) => {
  7. // Tables with locationId:
  8. // Retailer
  9. // Service
  10. // StaffMember
  11. // Workday
  12. console.log(chalk.red('Renaming locationId -> terminalId on retailers'))
  13. await queryInterface.renameColumn('retailers', 'locationId', 'terminalId')
  14. console.log(chalk.red('Renaming locationId -> terminalId on staffMembers'))
  15. await queryInterface.renameColumn('staffMembers', 'locationId', 'terminalId')
  16. console.log(chalk.red('Renaming locationId -> terminalId on workdays'))
  17. await queryInterface.renameColumn('workdays', 'locationId', 'terminalId')
  18. console.log(chalk.red('Renaming table locations -> terminals'))
  19. await queryInterface.renameTable('locations', 'terminals')
  20. return 1.01
  21. }
  22. }