@kipicore/dbcore 1.1.530 → 1.1.532
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/db/psql/migrations/{20251009061917-userHasUserHasCourses.js → 20260527095624-add-user-has-course-model.js} +14 -4
- package/dist/db/psql/migrations/20260527110000-add_fields_in_institute_subscription_plan_and_user_has_course.js +0 -12
- package/dist/models/psql/userHasCourseModel.js +1 -1
- package/package.json +1 -1
- package/dist/db/psql/migrations/20260527113000-fix_course_status_in_user_has_course.d.ts +0 -2
- package/dist/db/psql/migrations/20260527113000-fix_course_status_in_user_has_course.js +0 -40
- /package/dist/db/psql/migrations/{20251009061917-userHasUserHasCourses.d.ts → 20260527095624-add-user-has-course-model.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const up = async (queryInterface, Sequelize) => {
|
|
3
|
-
const tableName = '
|
|
3
|
+
const tableName = 'user_has_courses';
|
|
4
4
|
const tableExists = await queryInterface
|
|
5
5
|
.describeTable(tableName)
|
|
6
6
|
.then(() => true)
|
|
@@ -52,7 +52,12 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
52
52
|
type: Sequelize.STRING,
|
|
53
53
|
allowNull: true,
|
|
54
54
|
defaultValue: 'RUNNING',
|
|
55
|
-
field: '
|
|
55
|
+
field: 'course_status',
|
|
56
|
+
},
|
|
57
|
+
walletTransactionId: {
|
|
58
|
+
type: Sequelize.STRING,
|
|
59
|
+
allowNull: true,
|
|
60
|
+
field: 'wallet_transaction_id',
|
|
56
61
|
},
|
|
57
62
|
createdBy: {
|
|
58
63
|
type: Sequelize.UUID,
|
|
@@ -134,7 +139,12 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
134
139
|
type: Sequelize.STRING,
|
|
135
140
|
allowNull: true,
|
|
136
141
|
defaultValue: 'RUNNING',
|
|
137
|
-
field: '
|
|
142
|
+
field: 'course_status',
|
|
143
|
+
},
|
|
144
|
+
walletTransactionId: {
|
|
145
|
+
type: Sequelize.STRING,
|
|
146
|
+
allowNull: true,
|
|
147
|
+
field: 'wallet_transaction_id',
|
|
138
148
|
},
|
|
139
149
|
createdBy: {
|
|
140
150
|
type: Sequelize.UUID,
|
|
@@ -177,7 +187,7 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
177
187
|
}
|
|
178
188
|
};
|
|
179
189
|
const down = async (queryInterface) => {
|
|
180
|
-
const tableName = '
|
|
190
|
+
const tableName = 'user_has_courses';
|
|
181
191
|
const tableExists = await queryInterface
|
|
182
192
|
.describeTable(tableName)
|
|
183
193
|
.then(() => true)
|
|
@@ -27,14 +27,6 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
27
27
|
allowNull: true,
|
|
28
28
|
field: 'institute_id',
|
|
29
29
|
});
|
|
30
|
-
const userHasCoursesTable = await queryInterface.describeTable('userHasUserHasCourses');
|
|
31
|
-
if (!userHasCoursesTable.wallet_transaction_id) {
|
|
32
|
-
await queryInterface.addColumn('userHasUserHasCourses', 'wallet_transaction_id', {
|
|
33
|
-
type: Sequelize.STRING,
|
|
34
|
-
allowNull: true,
|
|
35
|
-
field: 'wallet_transaction_id',
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
30
|
};
|
|
39
31
|
const down = async (queryInterface, Sequelize) => {
|
|
40
32
|
const instituteSubscriptionPlansTable = await queryInterface.describeTable('institute_subscription_plans');
|
|
@@ -54,10 +46,6 @@ const down = async (queryInterface, Sequelize) => {
|
|
|
54
46
|
allowNull: false,
|
|
55
47
|
field: 'institute_id',
|
|
56
48
|
});
|
|
57
|
-
const userHasCoursesTable = await queryInterface.describeTable('userHasUserHasCourses');
|
|
58
|
-
if (userHasCoursesTable.wallet_transaction_id) {
|
|
59
|
-
await queryInterface.removeColumn('userHasUserHasCourses', 'wallet_transaction_id');
|
|
60
|
-
}
|
|
61
49
|
};
|
|
62
50
|
module.exports = {
|
|
63
51
|
up,
|
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const up = async (queryInterface, Sequelize) => {
|
|
3
|
-
const tableName = 'userHasUserHasCourses';
|
|
4
|
-
const table = await queryInterface.describeTable(tableName);
|
|
5
|
-
if (!table.course_status) {
|
|
6
|
-
await queryInterface.addColumn(tableName, 'course_status', {
|
|
7
|
-
type: Sequelize.STRING,
|
|
8
|
-
allowNull: true,
|
|
9
|
-
defaultValue: 'RUNNING',
|
|
10
|
-
field: 'course_status',
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
if (table.courseStatus) {
|
|
14
|
-
await queryInterface.sequelize.query(`UPDATE "${tableName}" SET "course_status" = COALESCE("course_status", "courseStatus") WHERE "courseStatus" IS NOT NULL;`);
|
|
15
|
-
await queryInterface.removeColumn(tableName, 'courseStatus');
|
|
16
|
-
}
|
|
17
|
-
if (table.user_has_course_status) {
|
|
18
|
-
await queryInterface.sequelize.query(`UPDATE "${tableName}" SET "course_status" = COALESCE("course_status", "user_has_course_status") WHERE "user_has_course_status" IS NOT NULL;`);
|
|
19
|
-
await queryInterface.removeColumn(tableName, 'user_has_course_status');
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const down = async (queryInterface, Sequelize) => {
|
|
23
|
-
const tableName = 'userHasUserHasCourses';
|
|
24
|
-
const table = await queryInterface.describeTable(tableName);
|
|
25
|
-
if (!table.courseStatus) {
|
|
26
|
-
await queryInterface.addColumn(tableName, 'courseStatus', {
|
|
27
|
-
type: Sequelize.STRING,
|
|
28
|
-
allowNull: true,
|
|
29
|
-
defaultValue: 'RUNNING',
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
if (table.course_status) {
|
|
33
|
-
await queryInterface.sequelize.query(`UPDATE "${tableName}" SET "courseStatus" = COALESCE("courseStatus", "course_status") WHERE "course_status" IS NOT NULL;`);
|
|
34
|
-
await queryInterface.removeColumn(tableName, 'course_status');
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
module.exports = {
|
|
38
|
-
up,
|
|
39
|
-
down,
|
|
40
|
-
};
|