@kipicore/dbcore 1.1.633 → 1.1.634
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.
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
module.exports = {
|
|
3
|
+
up: async (queryInterface, Sequelize) => {
|
|
4
|
+
const [results] = await queryInterface.sequelize.query(`
|
|
5
|
+
SELECT data_type
|
|
6
|
+
FROM information_schema.columns
|
|
7
|
+
WHERE table_name = 'class_room_event'
|
|
8
|
+
AND column_name = 'entity_id';
|
|
9
|
+
`);
|
|
10
|
+
if (results.length > 0 && results[0].data_type !== 'ARRAY') {
|
|
11
|
+
await queryInterface.sequelize.query(`
|
|
12
|
+
ALTER TABLE class_room_event
|
|
13
|
+
ALTER COLUMN entity_id TYPE VARCHAR[]
|
|
14
|
+
USING ARRAY[entity_id]::VARCHAR[];
|
|
15
|
+
`);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
down: async (queryInterface, Sequelize) => {
|
|
19
|
+
const [results] = await queryInterface.sequelize.query(`
|
|
20
|
+
SELECT data_type
|
|
21
|
+
FROM information_schema.columns
|
|
22
|
+
WHERE table_name = 'class_room_event'
|
|
23
|
+
AND column_name = 'entity_id';
|
|
24
|
+
`);
|
|
25
|
+
if (results.length > 0 && results[0].data_type === 'ARRAY') {
|
|
26
|
+
await queryInterface.sequelize.query(`
|
|
27
|
+
ALTER TABLE class_room_event
|
|
28
|
+
ALTER COLUMN entity_id TYPE UUID
|
|
29
|
+
USING (entity_id[1])::UUID;
|
|
30
|
+
`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
package/package.json
CHANGED