Skip to content

Commit 5d23c81

Browse files
committed
fix: migration script for scheduler
1 parent 705ef9d commit 5d23c81

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

migrations/2021-05-29-create-payment-scheduler-table-add-status-details-to-payment.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { PaymentSchedulerStatus } = require('../app-constants')
1010
module.exports = {
1111
up: async (queryInterface, Sequelize) => {
1212
const transaction = await queryInterface.sequelize.transaction()
13-
try {
13+
try {
1414
await queryInterface.createTable('payment_schedulers', {
1515
id: {
1616
type: Sequelize.UUID,
@@ -75,7 +75,6 @@ module.exports = {
7575
await queryInterface.changeColumn({ tableName: 'work_period_payments', schema: config.DB_SCHEMA_NAME }, 'challenge_id',
7676
{ type: Sequelize.UUID },
7777
{ transaction })
78-
await queryInterface.sequelize.query(`ALTER TYPE ${config.DB_SCHEMA_NAME}.enum_work_period_payments_status ADD VALUE 'scheduled'`)
7978
await queryInterface.sequelize.query(`ALTER TYPE ${config.DB_SCHEMA_NAME}.enum_work_period_payments_status ADD VALUE 'in-progress'`)
8079
await queryInterface.sequelize.query(`ALTER TYPE ${config.DB_SCHEMA_NAME}.enum_work_period_payments_status ADD VALUE 'failed'`)
8180
await transaction.commit()
@@ -101,7 +100,7 @@ module.exports = {
101100
{ transaction })
102101
await queryInterface.removeColumn({ tableName: 'work_period_payments', schema: config.DB_SCHEMA_NAME }, 'status_details',
103102
{ transaction })
104-
await queryInterface.sequelize.query(`DELETE FROM pg_enum WHERE enumlabel in ('scheduled', 'in-progress', 'failed') AND enumtypid = (SELECT oid FROM pg_type WHERE typname = 'enum_work_period_payments_status')`,
103+
await queryInterface.sequelize.query(`DELETE FROM pg_enum WHERE enumlabel in ('in-progress', 'failed') AND enumtypid = (SELECT oid FROM pg_type WHERE typname = 'enum_work_period_payments_status')`,
105104
{ transaction })
106105
await transaction.commit()
107106
} catch (err) {

0 commit comments

Comments
 (0)