@kipicore/dbcore 1.1.284 → 1.1.286

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,29 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('file_storage');
4
+ // Case 1: user_directory_id column does NOT exist → add as STRING
5
+ if (!table.user_directory_id) {
6
+ await queryInterface.addColumn('file_storage', 'user_directory_id', {
7
+ type: Sequelize.STRING,
8
+ allowNull: true,
9
+ });
10
+ }
11
+ // Case 2: user_directory_id exists AND type is UUID → change to STRING
12
+ else if (table.user_directory_id.type &&
13
+ table.user_directory_id.type.toLowerCase().includes('uuid')) {
14
+ await queryInterface.changeColumn('file_storage', 'user_directory_id', {
15
+ type: Sequelize.STRING,
16
+ allowNull: true,
17
+ });
18
+ }
19
+ };
20
+ const down = async (queryInterface, Sequelize) => {
21
+ const table = await queryInterface.describeTable('file_storage');
22
+ if (table.user_directory_id) {
23
+ await queryInterface.removeColumn('file_storage', 'user_directory_id');
24
+ }
25
+ };
26
+ module.exports = {
27
+ up,
28
+ down,
29
+ };
@@ -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,29 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('user_directories');
4
+ // Case 1: parent_id column does NOT exist → add as STRING
5
+ if (!table.parent_id) {
6
+ await queryInterface.addColumn('user_directories', 'parent_id', {
7
+ type: Sequelize.STRING,
8
+ allowNull: true,
9
+ });
10
+ }
11
+ // Case 2: parent_id exists AND type is UUID → change to STRING
12
+ else if (table.parent_id.type &&
13
+ table.parent_id.type.toLowerCase().includes('uuid')) {
14
+ await queryInterface.changeColumn('user_directories', 'parent_id', {
15
+ type: Sequelize.STRING,
16
+ allowNull: true,
17
+ });
18
+ }
19
+ };
20
+ const down = async (queryInterface, Sequelize) => {
21
+ const table = await queryInterface.describeTable('user_directories');
22
+ if (table.parent_id) {
23
+ await queryInterface.removeColumn('user_directories', 'parent_id');
24
+ }
25
+ };
26
+ module.exports = {
27
+ up,
28
+ down,
29
+ };
@@ -92,7 +92,7 @@ FileStorageModel.init({
92
92
  allowNull: true,
93
93
  },
94
94
  userDirectoryId: {
95
- type: sequelize_1.DataTypes.UUID,
95
+ type: sequelize_1.DataTypes.STRING,
96
96
  field: 'user_directory_id',
97
97
  allowNull: true,
98
98
  },
@@ -122,7 +122,7 @@ UserDirectoryModel.init({
122
122
  allowNull: true,
123
123
  },
124
124
  parentId: {
125
- type: sequelize_1.DataTypes.UUID,
125
+ type: sequelize_1.DataTypes.STRING,
126
126
  field: 'parent_id',
127
127
  allowNull: true,
128
128
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.284",
3
+ "version": "1.1.286",
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",