@kipicore/dbcore 1.1.284 → 1.1.285
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,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
|
+
};
|
package/package.json
CHANGED