@kipicore/dbcore 1.1.202 → 1.1.204
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.
|
@@ -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,28 +1,209 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
const up = async (queryInterface, Sequelize) => {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const tableName = 'school_fee_terms';
|
|
4
|
+
const tableExists = await queryInterface
|
|
5
|
+
.describeTable(tableName)
|
|
6
|
+
.then(() => true)
|
|
7
|
+
.catch(() => false);
|
|
8
|
+
if (!tableExists) {
|
|
9
|
+
await queryInterface.createTable(tableName, {
|
|
10
|
+
id: {
|
|
11
|
+
type: Sequelize.UUID,
|
|
12
|
+
defaultValue: Sequelize.UUIDV4,
|
|
13
|
+
allowNull: false,
|
|
14
|
+
primaryKey: true,
|
|
15
|
+
},
|
|
16
|
+
instituteId: {
|
|
17
|
+
type: Sequelize.UUID,
|
|
18
|
+
allowNull: true,
|
|
19
|
+
field: 'institute_id',
|
|
20
|
+
},
|
|
21
|
+
academicCalendarId: {
|
|
22
|
+
type: Sequelize.UUID,
|
|
23
|
+
allowNull: true,
|
|
24
|
+
field: 'academic_calendar_id',
|
|
25
|
+
},
|
|
26
|
+
stdId: {
|
|
27
|
+
type: Sequelize.UUID,
|
|
28
|
+
allowNull: true,
|
|
29
|
+
field: 'std_id',
|
|
30
|
+
},
|
|
31
|
+
feeTypeId: {
|
|
32
|
+
type: Sequelize.UUID,
|
|
33
|
+
allowNull: true,
|
|
34
|
+
field: 'fee_type_id',
|
|
35
|
+
},
|
|
36
|
+
frequency: {
|
|
37
|
+
type: Sequelize.STRING,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
},
|
|
40
|
+
amount: {
|
|
41
|
+
type: Sequelize.INTEGER,
|
|
42
|
+
allowNull: true,
|
|
43
|
+
},
|
|
44
|
+
date: {
|
|
45
|
+
type: Sequelize.DATE,
|
|
46
|
+
allowNull: true,
|
|
47
|
+
},
|
|
48
|
+
oldId: {
|
|
49
|
+
type: Sequelize.UUID,
|
|
50
|
+
allowNull: true,
|
|
51
|
+
field: 'old_id',
|
|
52
|
+
},
|
|
53
|
+
termsDependedId: {
|
|
54
|
+
type: Sequelize.STRING,
|
|
55
|
+
allowNull: true,
|
|
56
|
+
field: 'terms_depended_id',
|
|
57
|
+
},
|
|
58
|
+
createdBy: {
|
|
59
|
+
type: Sequelize.UUID,
|
|
60
|
+
allowNull: true,
|
|
61
|
+
field: 'created_by',
|
|
62
|
+
},
|
|
63
|
+
updatedBy: {
|
|
64
|
+
type: Sequelize.UUID,
|
|
65
|
+
allowNull: true,
|
|
66
|
+
field: 'updated_by',
|
|
67
|
+
},
|
|
68
|
+
deletedBy: {
|
|
69
|
+
type: Sequelize.UUID,
|
|
70
|
+
allowNull: true,
|
|
71
|
+
field: 'deleted_by',
|
|
72
|
+
},
|
|
73
|
+
createdAt: {
|
|
74
|
+
type: Sequelize.DATE,
|
|
75
|
+
allowNull: false,
|
|
76
|
+
defaultValue: Sequelize.NOW,
|
|
77
|
+
field: 'created_at',
|
|
78
|
+
},
|
|
79
|
+
updatedAt: {
|
|
80
|
+
type: Sequelize.DATE,
|
|
81
|
+
allowNull: false,
|
|
82
|
+
defaultValue: Sequelize.NOW,
|
|
83
|
+
field: 'updated_at',
|
|
84
|
+
},
|
|
85
|
+
deletedAt: {
|
|
86
|
+
type: Sequelize.DATE,
|
|
87
|
+
allowNull: true,
|
|
88
|
+
field: 'deleted_at',
|
|
89
|
+
},
|
|
90
|
+
title: {
|
|
91
|
+
type: Sequelize.STRING,
|
|
92
|
+
allowNull: true,
|
|
93
|
+
field: 'title',
|
|
94
|
+
},
|
|
95
|
+
schoolFeeId: {
|
|
96
|
+
type: Sequelize.STRING,
|
|
97
|
+
allowNull: true,
|
|
98
|
+
field: 'school_fee_id',
|
|
99
|
+
},
|
|
9
100
|
});
|
|
10
101
|
}
|
|
11
|
-
|
|
12
|
-
await queryInterface.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
102
|
+
else {
|
|
103
|
+
const tableDefinition = await queryInterface.describeTable(tableName);
|
|
104
|
+
const columnsToAdd = {
|
|
105
|
+
instituteId: {
|
|
106
|
+
type: Sequelize.UUID,
|
|
107
|
+
allowNull: true,
|
|
108
|
+
field: 'institute_id',
|
|
109
|
+
},
|
|
110
|
+
academicCalendarId: {
|
|
111
|
+
type: Sequelize.UUID,
|
|
112
|
+
allowNull: true,
|
|
113
|
+
field: 'academic_calendar_id',
|
|
114
|
+
},
|
|
115
|
+
stdId: {
|
|
116
|
+
type: Sequelize.UUID,
|
|
117
|
+
allowNull: true,
|
|
118
|
+
field: 'std_id',
|
|
119
|
+
},
|
|
120
|
+
feeTypeId: {
|
|
121
|
+
type: Sequelize.UUID,
|
|
122
|
+
allowNull: true,
|
|
123
|
+
field: 'fee_type_id',
|
|
124
|
+
},
|
|
125
|
+
frequency: {
|
|
126
|
+
type: Sequelize.STRING,
|
|
127
|
+
allowNull: true,
|
|
128
|
+
},
|
|
129
|
+
amount: {
|
|
130
|
+
type: Sequelize.INTEGER,
|
|
131
|
+
allowNull: true,
|
|
132
|
+
},
|
|
133
|
+
date: {
|
|
134
|
+
type: Sequelize.DATE,
|
|
135
|
+
allowNull: true,
|
|
136
|
+
},
|
|
137
|
+
oldId: {
|
|
138
|
+
type: Sequelize.UUID,
|
|
139
|
+
allowNull: true,
|
|
140
|
+
field: 'old_id',
|
|
141
|
+
},
|
|
142
|
+
termsDependedId: {
|
|
143
|
+
type: Sequelize.STRING,
|
|
144
|
+
allowNull: true,
|
|
145
|
+
field: 'terms_depended_id',
|
|
146
|
+
},
|
|
147
|
+
createdBy: {
|
|
148
|
+
type: Sequelize.UUID,
|
|
149
|
+
allowNull: true,
|
|
150
|
+
field: 'created_by',
|
|
151
|
+
},
|
|
152
|
+
updatedBy: {
|
|
153
|
+
type: Sequelize.UUID,
|
|
154
|
+
allowNull: true,
|
|
155
|
+
field: 'updated_by',
|
|
156
|
+
},
|
|
157
|
+
deletedBy: {
|
|
158
|
+
type: Sequelize.UUID,
|
|
159
|
+
allowNull: true,
|
|
160
|
+
field: 'deleted_by',
|
|
161
|
+
},
|
|
162
|
+
createdAt: {
|
|
163
|
+
type: Sequelize.DATE,
|
|
164
|
+
allowNull: false,
|
|
165
|
+
defaultValue: Sequelize.NOW,
|
|
166
|
+
field: 'created_at',
|
|
167
|
+
},
|
|
168
|
+
updatedAt: {
|
|
169
|
+
type: Sequelize.DATE,
|
|
170
|
+
allowNull: false,
|
|
171
|
+
defaultValue: Sequelize.NOW,
|
|
172
|
+
field: 'updated_at',
|
|
173
|
+
},
|
|
174
|
+
deletedAt: {
|
|
175
|
+
type: Sequelize.DATE,
|
|
176
|
+
allowNull: true,
|
|
177
|
+
field: 'deleted_at',
|
|
178
|
+
},
|
|
179
|
+
title: {
|
|
180
|
+
type: Sequelize.STRING,
|
|
181
|
+
allowNull: true,
|
|
182
|
+
field: 'title',
|
|
183
|
+
},
|
|
184
|
+
schoolFeeId: {
|
|
185
|
+
type: Sequelize.STRING,
|
|
186
|
+
allowNull: true,
|
|
187
|
+
field: 'school_fee_id',
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
for (const column of Object.keys(columnsToAdd)) {
|
|
191
|
+
const columnToAdd = columnsToAdd[column];
|
|
192
|
+
const tableColumn = columnToAdd.field || column;
|
|
193
|
+
if (!tableDefinition[tableColumn]) {
|
|
194
|
+
await queryInterface.addColumn(tableName, tableColumn, columnToAdd);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
17
197
|
}
|
|
18
198
|
};
|
|
19
|
-
const down = async (queryInterface
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
199
|
+
const down = async (queryInterface) => {
|
|
200
|
+
const tableName = 'school_fee_terms';
|
|
201
|
+
const tableExists = await queryInterface
|
|
202
|
+
.describeTable(tableName)
|
|
203
|
+
.then(() => true)
|
|
204
|
+
.catch(() => false);
|
|
205
|
+
if (tableExists) {
|
|
206
|
+
await queryInterface.dropTable(tableName);
|
|
26
207
|
}
|
|
27
208
|
};
|
|
28
209
|
module.exports = {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const table = await queryInterface.describeTable('subject_has_pay_fee_history');
|
|
4
|
+
// Check if column already exists
|
|
5
|
+
if (!table.academic_calendar_id) {
|
|
6
|
+
await queryInterface.addColumn('subject_has_pay_fee_history', 'academic_calendar_id', {
|
|
7
|
+
type: Sequelize.UUID,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
field: 'academic_calendar_id',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const down = async (queryInterface, Sequelize) => {
|
|
14
|
+
const table = await queryInterface.describeTable('subject_has_pay_fee_history');
|
|
15
|
+
// Remove only if column exists
|
|
16
|
+
if (table.academic_calendar_id) {
|
|
17
|
+
await queryInterface.removeColumn('subject_has_pay_fee_history', 'academic_calendar_id');
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
module.exports = {
|
|
21
|
+
up,
|
|
22
|
+
down,
|
|
23
|
+
};
|
package/package.json
CHANGED