@kipicore/dbcore 1.1.664 → 1.1.666
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/commonValidator/index.d.ts +1 -0
- package/dist/commonValidator/index.js +6 -0
- package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.d.ts +2 -0
- package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.js +42 -0
- package/dist/models/psql/fileStorageModel.js +3 -4
- package/package.json +1 -1
|
@@ -13,6 +13,12 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.BaseValidator = void 0;
|
|
17
21
|
__exportStar(require("./joiSchemaBuilder"), exports);
|
|
18
22
|
__exportStar(require("./joiCommonValidator"), exports);
|
|
23
|
+
var joiSchemaBuilder_1 = require("./joiSchemaBuilder");
|
|
24
|
+
Object.defineProperty(exports, "BaseValidator", { enumerable: true, get: function () { return __importDefault(joiSchemaBuilder_1).default; } });
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
module.exports = {
|
|
3
|
+
up: async (queryInterface, Sequelize) => {
|
|
4
|
+
const table = await queryInterface.describeTable('file_storage');
|
|
5
|
+
if (table.uploaded_from) {
|
|
6
|
+
// In PostgreSQL, changing from ENUM to VARCHAR requires a USING clause
|
|
7
|
+
try {
|
|
8
|
+
await queryInterface.sequelize.query('ALTER TABLE file_storage ALTER COLUMN uploaded_from TYPE VARCHAR(255) USING uploaded_from::varchar;');
|
|
9
|
+
await queryInterface.changeColumn('file_storage', 'uploaded_from', {
|
|
10
|
+
type: Sequelize.STRING,
|
|
11
|
+
allowNull: true,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
// Fallback if the raw query fails
|
|
16
|
+
await queryInterface.changeColumn('file_storage', 'uploaded_from', {
|
|
17
|
+
type: Sequelize.STRING,
|
|
18
|
+
allowNull: true,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
down: async (queryInterface, Sequelize) => {
|
|
24
|
+
const table = await queryInterface.describeTable('file_storage');
|
|
25
|
+
if (table.uploaded_from) {
|
|
26
|
+
try {
|
|
27
|
+
await queryInterface.sequelize.query('ALTER TABLE file_storage ALTER COLUMN uploaded_from TYPE "enum_file_storage_uploaded_from" USING uploaded_from::text::"enum_file_storage_uploaded_from";');
|
|
28
|
+
await queryInterface.changeColumn('file_storage', 'uploaded_from', {
|
|
29
|
+
type: Sequelize.ENUM('INSTITUTE_APP', 'SCHOOL_APP', 'GLOBAL_APP', 'STUDENT_APP', 'VENDOR_APP'),
|
|
30
|
+
allowNull: false,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
// Fallback
|
|
35
|
+
await queryInterface.changeColumn('file_storage', 'uploaded_from', {
|
|
36
|
+
type: Sequelize.ENUM('INSTITUTE_APP', 'SCHOOL_APP', 'GLOBAL_APP', 'STUDENT_APP', 'VENDOR_APP'),
|
|
37
|
+
allowNull: false,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const sequelize_1 = require("sequelize");
|
|
4
4
|
const index_1 = require("./index");
|
|
5
|
-
const app_1 = require("../../constants/app");
|
|
6
5
|
class FileStorageModel extends sequelize_1.Model {
|
|
7
6
|
static associate(models) {
|
|
8
7
|
const { UserModel, UserDirectoryModel } = models;
|
|
@@ -72,9 +71,9 @@ FileStorageModel.init({
|
|
|
72
71
|
allowNull: true,
|
|
73
72
|
},
|
|
74
73
|
uploadedFrom: {
|
|
75
|
-
type: sequelize_1.DataTypes.
|
|
76
|
-
|
|
77
|
-
allowNull:
|
|
74
|
+
type: sequelize_1.DataTypes.STRING,
|
|
75
|
+
field: 'uploaded_from',
|
|
76
|
+
allowNull: true,
|
|
78
77
|
},
|
|
79
78
|
instituteId: {
|
|
80
79
|
type: sequelize_1.DataTypes.UUID,
|
package/package.json
CHANGED