@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,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -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
+ };
@@ -103,7 +103,7 @@ ClassRoomEventModel.init({
103
103
  allowNull: true,
104
104
  },
105
105
  entityId: {
106
- type: sequelize_1.DataTypes.UUID,
106
+ type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.STRING),
107
107
  field: 'entity_id',
108
108
  allowNull: true,
109
109
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.633",
3
+ "version": "1.1.634",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",