@kipicore/dbcore 1.1.513 → 1.1.515
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs/env.js +1 -1
- package/dist/configs/postgresConfig.js +1 -1
- package/dist/db/psql/migrations/20251009053200-users.js +14 -14
- package/dist/db/psql/migrations/20251009055325-user_has_leave_history.js +35 -30
- package/dist/db/psql/migrations/20251009061032-user_has_device.js +0 -6
- package/dist/db/psql/migrations/20260203103251-update-academic-calendars-status-to-string.d.ts +2 -5
- package/dist/db/psql/migrations/20260203103251-update-academic-calendars-status-to-string.js +37 -26
- package/dist/db/psql/migrations/20260216051736-add_intId_to_userRequired_step.d.ts +1 -1
- package/dist/db/psql/migrations/20260216051736-add_intId_to_userRequired_step.js +25 -11
- package/dist/db/psql/migrations/20260519071913-change-parent-id-to-array-in-fee-submission-track.js +13 -15
- package/dist/models/psql/feeSubmissionTrackModel.js +1 -1
- package/package.json +1 -1
package/dist/configs/env.js
CHANGED
|
@@ -47,7 +47,7 @@ else {
|
|
|
47
47
|
}
|
|
48
48
|
const envValidation = joi_1.default.object()
|
|
49
49
|
.keys({
|
|
50
|
-
NODE_ENV: joi_1.default.string().trim().valid('local', 'development', 'production', 'test', 'staging').required(),
|
|
50
|
+
NODE_ENV: joi_1.default.string().trim().valid('local', 'development', 'production', 'test', 'staging', 'demo').required(),
|
|
51
51
|
PORT: joi_1.default.number().default(3000),
|
|
52
52
|
PG_DB_PORT: joi_1.default.number().default(3000),
|
|
53
53
|
PG_DB_HOST: joi_1.default.string().trim().required(),
|
|
@@ -14,7 +14,7 @@ const postgresConfig = {
|
|
|
14
14
|
password: process.env.PG_DB_PASSWORD,
|
|
15
15
|
database: process.env.PG_DB_NAME,
|
|
16
16
|
dbLogging: message => {
|
|
17
|
-
if (!['test', 'production', 'development', 'local', 'staging'].includes(process.env.NODE_ENV)) {
|
|
17
|
+
if (!['test', 'production', 'development', 'local', 'staging', 'demo'].includes(process.env.NODE_ENV)) {
|
|
18
18
|
console.log(message);
|
|
19
19
|
}
|
|
20
20
|
},
|
|
@@ -19,13 +19,13 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
19
19
|
type: Sequelize.STRING(30),
|
|
20
20
|
allowNull: false,
|
|
21
21
|
field: 'email_varification',
|
|
22
|
-
defaultValue:
|
|
22
|
+
defaultValue: 'PENDING',
|
|
23
23
|
},
|
|
24
24
|
mobileVerification: {
|
|
25
25
|
type: Sequelize.STRING(30),
|
|
26
26
|
allowNull: false,
|
|
27
27
|
field: 'mobile_varification',
|
|
28
|
-
defaultValue:
|
|
28
|
+
defaultValue: 'PENDING',
|
|
29
29
|
},
|
|
30
30
|
appType: {
|
|
31
31
|
type: Sequelize.ENUM('INSTITUTE_APP', 'SCHOOL_APP', 'GLOBAL_APP', 'STUDENT_APP'),
|
|
@@ -64,32 +64,32 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
64
64
|
createdBy: {
|
|
65
65
|
type: Sequelize.UUID,
|
|
66
66
|
allowNull: true,
|
|
67
|
-
field: 'created_by'
|
|
67
|
+
field: 'created_by',
|
|
68
68
|
},
|
|
69
69
|
updatedBy: {
|
|
70
70
|
type: Sequelize.UUID,
|
|
71
71
|
allowNull: true,
|
|
72
|
-
field: 'updated_by'
|
|
72
|
+
field: 'updated_by',
|
|
73
73
|
},
|
|
74
74
|
deletedBy: {
|
|
75
75
|
type: Sequelize.UUID,
|
|
76
76
|
allowNull: true,
|
|
77
|
-
field: 'deleted_by'
|
|
77
|
+
field: 'deleted_by',
|
|
78
78
|
},
|
|
79
79
|
createdAt: {
|
|
80
80
|
type: Sequelize.DATE,
|
|
81
81
|
allowNull: false,
|
|
82
|
-
field: 'created_at'
|
|
82
|
+
field: 'created_at',
|
|
83
83
|
},
|
|
84
84
|
updatedAt: {
|
|
85
85
|
type: Sequelize.DATE,
|
|
86
86
|
allowNull: false,
|
|
87
|
-
field: 'updated_at'
|
|
87
|
+
field: 'updated_at',
|
|
88
88
|
},
|
|
89
89
|
deletedAt: {
|
|
90
90
|
type: Sequelize.DATE,
|
|
91
91
|
allowNull: true,
|
|
92
|
-
field: 'deleted_at'
|
|
92
|
+
field: 'deleted_at',
|
|
93
93
|
},
|
|
94
94
|
});
|
|
95
95
|
}
|
|
@@ -153,32 +153,32 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
153
153
|
createdBy: {
|
|
154
154
|
type: Sequelize.UUID,
|
|
155
155
|
allowNull: true,
|
|
156
|
-
field: 'created_by'
|
|
156
|
+
field: 'created_by',
|
|
157
157
|
},
|
|
158
158
|
updatedBy: {
|
|
159
159
|
type: Sequelize.UUID,
|
|
160
160
|
allowNull: true,
|
|
161
|
-
field: 'updated_by'
|
|
161
|
+
field: 'updated_by',
|
|
162
162
|
},
|
|
163
163
|
deletedBy: {
|
|
164
164
|
type: Sequelize.UUID,
|
|
165
165
|
allowNull: true,
|
|
166
|
-
field: 'deleted_by'
|
|
166
|
+
field: 'deleted_by',
|
|
167
167
|
},
|
|
168
168
|
createdAt: {
|
|
169
169
|
type: Sequelize.DATE,
|
|
170
170
|
allowNull: false,
|
|
171
|
-
field: 'created_at'
|
|
171
|
+
field: 'created_at',
|
|
172
172
|
},
|
|
173
173
|
updatedAt: {
|
|
174
174
|
type: Sequelize.DATE,
|
|
175
175
|
allowNull: false,
|
|
176
|
-
field: 'updated_at'
|
|
176
|
+
field: 'updated_at',
|
|
177
177
|
},
|
|
178
178
|
deletedAt: {
|
|
179
179
|
type: Sequelize.DATE,
|
|
180
180
|
allowNull: true,
|
|
181
|
-
field: 'deleted_at'
|
|
181
|
+
field: 'deleted_at',
|
|
182
182
|
},
|
|
183
183
|
};
|
|
184
184
|
for (const column of Object.keys(columnsToAdd)) {
|
|
@@ -15,33 +15,33 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
15
15
|
userId: {
|
|
16
16
|
type: Sequelize.UUID,
|
|
17
17
|
allowNull: false,
|
|
18
|
-
field: 'user_id'
|
|
18
|
+
field: 'user_id',
|
|
19
19
|
},
|
|
20
20
|
instituteId: {
|
|
21
21
|
type: Sequelize.UUID,
|
|
22
22
|
allowNull: false,
|
|
23
|
-
field: 'institute_id'
|
|
23
|
+
field: 'institute_id',
|
|
24
24
|
},
|
|
25
25
|
userLeaveRequestId: {
|
|
26
26
|
type: Sequelize.UUID,
|
|
27
27
|
allowNull: false,
|
|
28
|
-
field: 'user_leave_request_id'
|
|
28
|
+
field: 'user_leave_request_id',
|
|
29
29
|
},
|
|
30
30
|
userHasLeaveId: {
|
|
31
31
|
type: Sequelize.UUID,
|
|
32
32
|
allowNull: false,
|
|
33
|
-
field: 'user_has_leave_id'
|
|
33
|
+
field: 'user_has_leave_id',
|
|
34
34
|
},
|
|
35
35
|
usedLeave: {
|
|
36
36
|
type: Sequelize.FLOAT,
|
|
37
37
|
defaultValue: 0,
|
|
38
38
|
allowNull: false,
|
|
39
|
-
field: 'used_leave'
|
|
39
|
+
field: 'used_leave',
|
|
40
40
|
},
|
|
41
41
|
leaveType: {
|
|
42
42
|
type: Sequelize.ENUM('FULL_DAY', 'FIRST_HALF', 'SECOND_HALF'),
|
|
43
43
|
allowNull: false,
|
|
44
|
-
field: 'leave_type'
|
|
44
|
+
field: 'leave_type',
|
|
45
45
|
},
|
|
46
46
|
leave: {
|
|
47
47
|
type: Sequelize.ENUM('PAID', 'UN_PAID'),
|
|
@@ -53,54 +53,59 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
53
53
|
allowNull: true,
|
|
54
54
|
},
|
|
55
55
|
status: {
|
|
56
|
-
type: Sequelize.ENUM('PENDING', 'ACCEPTED', 'REJECTED', '
|
|
56
|
+
type: Sequelize.ENUM('PENDING', 'ACCEPTED', 'REJECTED', 'CANCELLED'),
|
|
57
57
|
defaultValue: 'PENDING',
|
|
58
58
|
allowNull: false,
|
|
59
59
|
},
|
|
60
60
|
startTime: {
|
|
61
61
|
type: Sequelize.DATE,
|
|
62
62
|
allowNull: false,
|
|
63
|
-
field: 'start_time'
|
|
63
|
+
field: 'start_time',
|
|
64
64
|
},
|
|
65
65
|
endTime: {
|
|
66
66
|
type: Sequelize.DATE,
|
|
67
67
|
allowNull: false,
|
|
68
|
-
field: 'end_time'
|
|
68
|
+
field: 'end_time',
|
|
69
69
|
},
|
|
70
70
|
createdBy: {
|
|
71
71
|
type: Sequelize.UUID,
|
|
72
72
|
allowNull: true,
|
|
73
|
-
field: 'created_by'
|
|
73
|
+
field: 'created_by',
|
|
74
74
|
},
|
|
75
75
|
updatedBy: {
|
|
76
76
|
type: Sequelize.UUID,
|
|
77
77
|
allowNull: true,
|
|
78
|
-
field: 'updated_by'
|
|
78
|
+
field: 'updated_by',
|
|
79
79
|
},
|
|
80
80
|
deletedBy: {
|
|
81
81
|
type: Sequelize.UUID,
|
|
82
82
|
allowNull: true,
|
|
83
|
-
field: 'deleted_by'
|
|
83
|
+
field: 'deleted_by',
|
|
84
84
|
},
|
|
85
85
|
createdAt: {
|
|
86
86
|
type: Sequelize.DATE,
|
|
87
87
|
allowNull: false,
|
|
88
|
-
field: 'created_at'
|
|
88
|
+
field: 'created_at',
|
|
89
89
|
},
|
|
90
90
|
updatedAt: {
|
|
91
91
|
type: Sequelize.DATE,
|
|
92
92
|
allowNull: false,
|
|
93
|
-
field: 'updated_at'
|
|
93
|
+
field: 'updated_at',
|
|
94
94
|
},
|
|
95
95
|
deletedAt: {
|
|
96
96
|
type: Sequelize.DATE,
|
|
97
97
|
allowNull: true,
|
|
98
|
-
field: 'deleted_at'
|
|
98
|
+
field: 'deleted_at',
|
|
99
99
|
},
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
103
|
const tableDefinition = await queryInterface.describeTable(tableName);
|
|
104
|
+
await queryInterface.sequelize.query(`
|
|
105
|
+
DROP TYPE IF EXISTS "enum_user_has_leave_history_status";
|
|
106
|
+
DROP TYPE IF EXISTS "enum_user_has_leave_history_leave";
|
|
107
|
+
DROP TYPE IF EXISTS "enum_user_has_leave_history_leave_type";
|
|
108
|
+
`);
|
|
104
109
|
const columnsToAdd = {
|
|
105
110
|
id: {
|
|
106
111
|
type: Sequelize.UUID,
|
|
@@ -110,33 +115,33 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
110
115
|
userId: {
|
|
111
116
|
type: Sequelize.UUID,
|
|
112
117
|
allowNull: false,
|
|
113
|
-
field: 'user_id'
|
|
118
|
+
field: 'user_id',
|
|
114
119
|
},
|
|
115
120
|
instituteId: {
|
|
116
121
|
type: Sequelize.UUID,
|
|
117
122
|
allowNull: false,
|
|
118
|
-
field: 'institute_id'
|
|
123
|
+
field: 'institute_id',
|
|
119
124
|
},
|
|
120
125
|
userLeaveRequestId: {
|
|
121
126
|
type: Sequelize.UUID,
|
|
122
127
|
allowNull: false,
|
|
123
|
-
field: 'user_leave_request_id'
|
|
128
|
+
field: 'user_leave_request_id',
|
|
124
129
|
},
|
|
125
130
|
userHasLeaveId: {
|
|
126
131
|
type: Sequelize.UUID,
|
|
127
132
|
allowNull: false,
|
|
128
|
-
field: 'user_has_leave_id'
|
|
133
|
+
field: 'user_has_leave_id',
|
|
129
134
|
},
|
|
130
135
|
usedLeave: {
|
|
131
136
|
type: Sequelize.FLOAT,
|
|
132
137
|
defaultValue: 0,
|
|
133
138
|
allowNull: false,
|
|
134
|
-
field: 'used_leave'
|
|
139
|
+
field: 'used_leave',
|
|
135
140
|
},
|
|
136
141
|
leaveType: {
|
|
137
142
|
type: Sequelize.ENUM('FULL_DAY', 'FIRST_HALF', 'SECOND_HALF'),
|
|
138
143
|
allowNull: false,
|
|
139
|
-
field: 'leave_type'
|
|
144
|
+
field: 'leave_type',
|
|
140
145
|
},
|
|
141
146
|
leave: {
|
|
142
147
|
type: Sequelize.ENUM('PAID', 'UN_PAID'),
|
|
@@ -148,49 +153,49 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
148
153
|
allowNull: true,
|
|
149
154
|
},
|
|
150
155
|
status: {
|
|
151
|
-
type: Sequelize.ENUM('PENDING', 'ACCEPTED', 'REJECTED', '
|
|
156
|
+
type: Sequelize.ENUM('PENDING', 'ACCEPTED', 'REJECTED', 'CANCELLED'),
|
|
152
157
|
defaultValue: 'PENDING',
|
|
153
158
|
allowNull: false,
|
|
154
159
|
},
|
|
155
160
|
startTime: {
|
|
156
161
|
type: Sequelize.DATE,
|
|
157
162
|
allowNull: false,
|
|
158
|
-
field: 'start_time'
|
|
163
|
+
field: 'start_time',
|
|
159
164
|
},
|
|
160
165
|
endTime: {
|
|
161
166
|
type: Sequelize.DATE,
|
|
162
167
|
allowNull: false,
|
|
163
|
-
field: 'end_time'
|
|
168
|
+
field: 'end_time',
|
|
164
169
|
},
|
|
165
170
|
createdBy: {
|
|
166
171
|
type: Sequelize.UUID,
|
|
167
172
|
allowNull: true,
|
|
168
|
-
field: 'created_by'
|
|
173
|
+
field: 'created_by',
|
|
169
174
|
},
|
|
170
175
|
updatedBy: {
|
|
171
176
|
type: Sequelize.UUID,
|
|
172
177
|
allowNull: true,
|
|
173
|
-
field: 'updated_by'
|
|
178
|
+
field: 'updated_by',
|
|
174
179
|
},
|
|
175
180
|
deletedBy: {
|
|
176
181
|
type: Sequelize.UUID,
|
|
177
182
|
allowNull: true,
|
|
178
|
-
field: 'deleted_by'
|
|
183
|
+
field: 'deleted_by',
|
|
179
184
|
},
|
|
180
185
|
createdAt: {
|
|
181
186
|
type: Sequelize.DATE,
|
|
182
187
|
allowNull: false,
|
|
183
|
-
field: 'created_at'
|
|
188
|
+
field: 'created_at',
|
|
184
189
|
},
|
|
185
190
|
updatedAt: {
|
|
186
191
|
type: Sequelize.DATE,
|
|
187
192
|
allowNull: false,
|
|
188
|
-
field: 'updated_at'
|
|
193
|
+
field: 'updated_at',
|
|
189
194
|
},
|
|
190
195
|
deletedAt: {
|
|
191
196
|
type: Sequelize.DATE,
|
|
192
197
|
allowNull: true,
|
|
193
|
-
field: 'deleted_at'
|
|
198
|
+
field: 'deleted_at',
|
|
194
199
|
},
|
|
195
200
|
};
|
|
196
201
|
for (const column of Object.keys(columnsToAdd)) {
|
|
@@ -68,12 +68,6 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
68
68
|
field: 'deleted_at',
|
|
69
69
|
},
|
|
70
70
|
});
|
|
71
|
-
await queryInterface.addIndex(tableName, {
|
|
72
|
-
name: 'user_device_unique_key',
|
|
73
|
-
unique: true,
|
|
74
|
-
fields: ['user_id', 'device_id'],
|
|
75
|
-
where: { deleted_at: null, type: NOTIFICATION_ACTION.PUSH },
|
|
76
|
-
});
|
|
77
71
|
}
|
|
78
72
|
else {
|
|
79
73
|
const tableDefinition = await queryInterface.describeTable(tableName);
|
package/dist/db/psql/migrations/20260203103251-update-academic-calendars-status-to-string.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function down(queryInterface: any): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
1
|
+
export function up(queryInterface: any): Promise<void>;
|
|
2
|
+
export function down(queryInterface: any): Promise<void>;
|
package/dist/db/psql/migrations/20260203103251-update-academic-calendars-status-to-string.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const sequelize_1 = require("sequelize");
|
|
4
|
-
exports.default = {
|
|
2
|
+
module.exports = {
|
|
5
3
|
up: async (queryInterface) => {
|
|
6
|
-
//
|
|
7
|
-
await queryInterface.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
// Remove existing default first
|
|
5
|
+
await queryInterface.sequelize.query(`
|
|
6
|
+
ALTER TABLE academic_calendars
|
|
7
|
+
ALTER COLUMN status DROP DEFAULT;
|
|
8
|
+
`);
|
|
9
|
+
// Convert ENUM -> STRING
|
|
10
|
+
await queryInterface.sequelize.query(`
|
|
11
|
+
ALTER TABLE academic_calendars
|
|
12
|
+
ALTER COLUMN status TYPE VARCHAR
|
|
13
|
+
USING status::text;
|
|
14
|
+
`);
|
|
15
|
+
// Add new default
|
|
16
|
+
await queryInterface.sequelize.query(`
|
|
17
|
+
ALTER TABLE academic_calendars
|
|
18
|
+
ALTER COLUMN status SET DEFAULT 'FUTURE_ACADEMIC_CALENDAR';
|
|
19
|
+
`);
|
|
20
|
+
// Drop ENUM type
|
|
21
|
+
await queryInterface.sequelize.query(`
|
|
22
|
+
DROP TYPE IF EXISTS "enum_academic_calendars_status";
|
|
22
23
|
`);
|
|
23
24
|
},
|
|
24
25
|
down: async (queryInterface) => {
|
|
25
|
-
//
|
|
26
|
+
// Recreate ENUM
|
|
26
27
|
await queryInterface.sequelize.query(`
|
|
27
28
|
CREATE TYPE "enum_academic_calendars_status" AS ENUM (
|
|
28
29
|
'PAST_ACADEMIC_CALENDAR',
|
|
@@ -31,11 +32,21 @@ exports.default = {
|
|
|
31
32
|
'SUB_ACADEMIC_CALENDAR'
|
|
32
33
|
);
|
|
33
34
|
`);
|
|
34
|
-
//
|
|
35
|
-
await queryInterface.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
// Remove string default
|
|
36
|
+
await queryInterface.sequelize.query(`
|
|
37
|
+
ALTER TABLE academic_calendars
|
|
38
|
+
ALTER COLUMN status DROP DEFAULT;
|
|
39
|
+
`);
|
|
40
|
+
// Convert STRING -> ENUM
|
|
41
|
+
await queryInterface.sequelize.query(`
|
|
42
|
+
ALTER TABLE academic_calendars
|
|
43
|
+
ALTER COLUMN status TYPE "enum_academic_calendars_status"
|
|
44
|
+
USING status::"enum_academic_calendars_status";
|
|
45
|
+
`);
|
|
46
|
+
// Restore ENUM default
|
|
47
|
+
await queryInterface.sequelize.query(`
|
|
48
|
+
ALTER TABLE academic_calendars
|
|
49
|
+
ALTER COLUMN status SET DEFAULT 'FUTURE_ACADEMIC_CALENDAR';
|
|
50
|
+
`);
|
|
40
51
|
},
|
|
41
52
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export function up(queryInterface: any, Sequelize: any): Promise<void>;
|
|
2
|
-
export function down(queryInterface: any
|
|
2
|
+
export function down(queryInterface: any): Promise<void>;
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const up = async (queryInterface, Sequelize) => {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
const tableName = 'user_required_steps';
|
|
4
|
+
const tableExists = await queryInterface
|
|
5
|
+
.describeTable(tableName)
|
|
6
|
+
.then(() => true)
|
|
7
|
+
.catch(() => false);
|
|
8
|
+
if (tableExists) {
|
|
9
|
+
const table = await queryInterface.describeTable(tableName);
|
|
10
|
+
if (!table.institute_id) {
|
|
11
|
+
await queryInterface.addColumn(tableName, 'institute_id', {
|
|
12
|
+
type: Sequelize.UUID,
|
|
13
|
+
allowNull: true,
|
|
14
|
+
field: 'institute_id',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
10
17
|
}
|
|
11
18
|
};
|
|
12
|
-
const down = async (queryInterface
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
const down = async (queryInterface) => {
|
|
20
|
+
const tableName = 'user_required_steps';
|
|
21
|
+
const tableExists = await queryInterface
|
|
22
|
+
.describeTable(tableName)
|
|
23
|
+
.then(() => true)
|
|
24
|
+
.catch(() => false);
|
|
25
|
+
if (tableExists) {
|
|
26
|
+
const table = await queryInterface.describeTable(tableName);
|
|
27
|
+
if (table.institute_id) {
|
|
28
|
+
await queryInterface.removeColumn(tableName, 'institute_id');
|
|
29
|
+
}
|
|
16
30
|
}
|
|
17
31
|
};
|
|
18
32
|
module.exports = {
|
package/dist/db/psql/migrations/20260519071913-change-parent-id-to-array-in-fee-submission-track.js
CHANGED
|
@@ -2,29 +2,27 @@
|
|
|
2
2
|
const up = async (queryInterface, Sequelize) => {
|
|
3
3
|
const tableName = 'fee_submission_track';
|
|
4
4
|
const tableDescription = await queryInterface.describeTable(tableName);
|
|
5
|
-
// If column exists ->
|
|
5
|
+
// If column exists -> remove it
|
|
6
6
|
if (tableDescription.parent_id) {
|
|
7
|
-
await queryInterface.
|
|
8
|
-
type: Sequelize.ARRAY(Sequelize.UUID),
|
|
9
|
-
allowNull: true,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
await queryInterface.addColumn(tableName, 'parent_id', {
|
|
14
|
-
type: Sequelize.ARRAY(Sequelize.UUID),
|
|
15
|
-
allowNull: true,
|
|
16
|
-
});
|
|
7
|
+
await queryInterface.removeColumn(tableName, 'parent_id');
|
|
17
8
|
}
|
|
9
|
+
// Add fresh array column
|
|
10
|
+
await queryInterface.addColumn(tableName, 'parent_id', {
|
|
11
|
+
type: Sequelize.ARRAY(Sequelize.STRING),
|
|
12
|
+
allowNull: true,
|
|
13
|
+
});
|
|
18
14
|
};
|
|
19
15
|
const down = async (queryInterface, Sequelize) => {
|
|
20
16
|
const tableName = 'fee_submission_track';
|
|
21
17
|
const tableDescription = await queryInterface.describeTable(tableName);
|
|
22
18
|
if (tableDescription.parent_id) {
|
|
23
|
-
await queryInterface.
|
|
24
|
-
type: Sequelize.ARRAY(Sequelize.UUID),
|
|
25
|
-
allowNull: true,
|
|
26
|
-
});
|
|
19
|
+
await queryInterface.removeColumn(tableName, 'parent_id');
|
|
27
20
|
}
|
|
21
|
+
// Optional: recreate old column type
|
|
22
|
+
await queryInterface.addColumn(tableName, 'parent_id', {
|
|
23
|
+
type: Sequelize.STRING,
|
|
24
|
+
allowNull: true,
|
|
25
|
+
});
|
|
28
26
|
};
|
|
29
27
|
module.exports = {
|
|
30
28
|
up,
|
package/package.json
CHANGED