@abtnode/models 1.17.8-beta-20260113-015027-32a1cec4 → 1.17.8-beta-20260115-003043-5e15c08a
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/lib/migrate.d.ts +1 -0
- package/lib/migrate.js +9 -1
- package/lib/migrations/blocklet/20231031000000-project.js +4 -17
- package/lib/migrations/blocklet/20240202000000-project.js +4 -17
- package/lib/migrations/blocklet/20240322000000-project-last-release.js +9 -21
- package/lib/migrations/blocklet/20240327000000-release-published.js +4 -17
- package/lib/migrations/blocklet/20240413000000-project-connected-stores.js +4 -17
- package/lib/migrations/blocklet/20240520000000-project-tenant-scope.js +12 -29
- package/lib/migrations/blocklet/20240621000000-project-upload-resource.js +4 -17
- package/lib/migrations/blocklet/20240724000000-projec-add-setting.js +10 -25
- package/lib/migrations/blocklet/20240808000000-user-phone.js +5 -10
- package/lib/migrations/blocklet/20240828000000-user-inviter.js +1 -1
- package/lib/migrations/blocklet/20241202000000-homepage.js +15 -32
- package/lib/migrations/blocklet/20241212000000-videos.js +5 -18
- package/lib/migrations/blocklet/20241216000000-notification.js +11 -15
- package/lib/migrations/blocklet/20241216000000-repository.js +5 -18
- package/lib/migrations/blocklet/20241223000000-blocklet-docker.js +10 -25
- package/lib/migrations/blocklet/20241224000001-notification.js +4 -8
- package/lib/migrations/blocklet/20241225000000-passkey.js +9 -18
- package/lib/migrations/blocklet/20250703000001-update-webhook-attempt-status.js +3 -2
- package/lib/migrations/blocklet/20250716000001-release-blocklet-introduction-length.js +5 -4
- package/lib/migrations/blocklet/20250718000002-change-some-colume-length.js +7 -6
- package/lib/migrations/blocklet/20250826000000-change-access-key-type.js +3 -2
- package/lib/migrations/certificate-manager/20250911000000-job-processing.js +5 -4
- package/lib/migrations/certificate-manager/20251224000000-job-entity-id.js +2 -2
- package/lib/migrations/common/20250117000000-notification-receiver.js +40 -64
- package/lib/migrations/common/20250211000000-notification-receiver.js +15 -39
- package/lib/migrations/common/20250220000000-user.js +7 -31
- package/lib/migrations/common/20250313000000-user.js +7 -31
- package/lib/migrations/common/20250319000000-notifications.js +7 -32
- package/lib/migrations/common/20250330000000-check-passport.js +7 -9
- package/lib/migrations/common/20250831000000-notifications.js +7 -32
- package/lib/migrations/server/20230713000000-backup.js +3 -2
- package/lib/migrations/server/20241216000000-notification.js +11 -15
- package/lib/migrations/server/20241224000001-notification.js +4 -8
- package/lib/migrations/server/20241225000000-passkey.js +1 -1
- package/lib/migrations/server/20250625000001-server-launcher.js +1 -1
- package/lib/migrations/server/20250704000000-upgrade-session-id.js +3 -2
- package/lib/migrations/server/20250718000002-change-some-colume-length.js +7 -6
- package/lib/migrations/server/20250826000000-change-access-key-type.js +3 -2
- package/lib/migrations/server/20250911000000-job-processing.js +5 -4
- package/lib/migrations/server/20251220000000-job-entity-id.js +2 -2
- package/lib/migrations/service/20250403000001-message.js +9 -28
- package/package.json +9 -9
package/lib/migrate.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const safeAddIndex: (context: QueryInterface, table: string, inde
|
|
|
9
9
|
export declare function safeDescribeTable(qi: QueryInterface, table: string): Promise<Record<string, any>>;
|
|
10
10
|
export declare const addColumnIfNotExists: (context: QueryInterface, table: string, column: string, field: any, options?: any) => Promise<void>;
|
|
11
11
|
export declare const removeColumnIfExists: (context: QueryInterface, table: string, column: string, options?: any) => Promise<void>;
|
|
12
|
+
export declare const changeColumnIfExists: (context: QueryInterface, table: string, column: string, field: any, options?: any) => Promise<void>;
|
|
12
13
|
export declare const createTableIfNotExists: (context: QueryInterface, table: string, schema: any, options?: any) => Promise<void>;
|
|
13
14
|
export declare const dropTableIfExists: (context: QueryInterface, table: string) => Promise<void>;
|
|
14
15
|
export {};
|
package/lib/migrate.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.dropTableIfExists = exports.createTableIfNotExists = exports.removeColumnIfExists = exports.addColumnIfNotExists = exports.safeAddIndex = void 0;
|
|
6
|
+
exports.dropTableIfExists = exports.createTableIfNotExists = exports.changeColumnIfExists = exports.removeColumnIfExists = exports.addColumnIfNotExists = exports.safeAddIndex = void 0;
|
|
7
7
|
exports.doSchemaMigration = doSchemaMigration;
|
|
8
8
|
exports.safeApplyColumnChanges = safeApplyColumnChanges;
|
|
9
9
|
exports.safeDescribeTable = safeDescribeTable;
|
|
@@ -109,6 +109,14 @@ const removeColumnIfExists = async (context, table, column, options) => {
|
|
|
109
109
|
await context.removeColumn(table, column, options);
|
|
110
110
|
};
|
|
111
111
|
exports.removeColumnIfExists = removeColumnIfExists;
|
|
112
|
+
const changeColumnIfExists = async (context, table, column, field, options) => {
|
|
113
|
+
const schema = await safeDescribeTable(context, table);
|
|
114
|
+
if (!schema[column]) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
await context.changeColumn(table, column, field, options);
|
|
118
|
+
};
|
|
119
|
+
exports.changeColumnIfExists = changeColumnIfExists;
|
|
112
120
|
const createTableIfNotExists = async (context, table, schema, options) => {
|
|
113
121
|
try {
|
|
114
122
|
// 如果表存在,这里会成功返回描述信息
|
|
@@ -4,23 +4,10 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
await queryInterface.addColumn('projects', 'componentDid', {
|
|
12
|
-
type: sequelize_1.DataTypes.STRING(80),
|
|
13
|
-
allowNull: true,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
19
|
-
// ignore
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
throw err;
|
|
23
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'componentDid', {
|
|
8
|
+
type: sequelize_1.DataTypes.STRING(80),
|
|
9
|
+
allowNull: true,
|
|
10
|
+
});
|
|
24
11
|
};
|
|
25
12
|
exports.up = up;
|
|
26
13
|
const down = async ({ context }) => {
|
|
@@ -4,23 +4,10 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const migrate_1 = require("../../migrate");
|
|
5
5
|
const util_1 = require("../../util");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
await queryInterface.addColumn('releases', 'blockletComponents', {
|
|
12
|
-
type: (0, util_1.JSONOrJSONB)(),
|
|
13
|
-
allowNull: true,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
19
|
-
// ignore
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
throw err;
|
|
23
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'blockletComponents', {
|
|
8
|
+
type: (0, util_1.JSONOrJSONB)(),
|
|
9
|
+
allowNull: true,
|
|
10
|
+
});
|
|
24
11
|
};
|
|
25
12
|
exports.up = up;
|
|
26
13
|
const down = async ({ context }) => {
|
|
@@ -5,30 +5,18 @@ const sequelize_1 = require("sequelize");
|
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const util_1 = require("../../util");
|
|
7
7
|
const up = async ({ context }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
await queryInterface.addColumn('projects', 'lastReleaseFiles', {
|
|
17
|
-
type: (0, util_1.JSONOrJSONB)(),
|
|
18
|
-
allowNull: true,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
24
|
-
// ignore
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
throw err;
|
|
28
|
-
}
|
|
8
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'lastReleaseId', {
|
|
9
|
+
type: sequelize_1.DataTypes.STRING(80),
|
|
10
|
+
allowNull: true,
|
|
11
|
+
});
|
|
12
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'lastReleaseFiles', {
|
|
13
|
+
type: (0, util_1.JSONOrJSONB)(),
|
|
14
|
+
allowNull: true,
|
|
15
|
+
});
|
|
29
16
|
};
|
|
30
17
|
exports.up = up;
|
|
31
18
|
const down = async ({ context }) => {
|
|
32
19
|
await (0, migrate_1.removeColumnIfExists)(context, 'projects', 'lastReleaseId');
|
|
20
|
+
await (0, migrate_1.removeColumnIfExists)(context, 'projects', 'lastReleaseFiles');
|
|
33
21
|
};
|
|
34
22
|
exports.down = down;
|
|
@@ -4,23 +4,10 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const migrate_1 = require("../../migrate");
|
|
5
5
|
const util_1 = require("../../util");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
await queryInterface.addColumn('releases', 'publishedStoreIds', {
|
|
12
|
-
type: (0, util_1.JSONOrJSONB)(),
|
|
13
|
-
defaultValue: [],
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
19
|
-
// ignore
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
throw err;
|
|
23
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'publishedStoreIds', {
|
|
8
|
+
type: (0, util_1.JSONOrJSONB)(),
|
|
9
|
+
defaultValue: [],
|
|
10
|
+
});
|
|
24
11
|
};
|
|
25
12
|
exports.up = up;
|
|
26
13
|
const down = async ({ context }) => {
|
|
@@ -4,23 +4,10 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const migrate_1 = require("../../migrate");
|
|
5
5
|
const util_1 = require("../../util");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
await queryInterface.addColumn('projects', 'connectedStores', {
|
|
12
|
-
type: (0, util_1.JSONOrJSONB)(),
|
|
13
|
-
defaultValue: [],
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
19
|
-
// ignore
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
throw err;
|
|
23
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'connectedStores', {
|
|
8
|
+
type: (0, util_1.JSONOrJSONB)(),
|
|
9
|
+
defaultValue: [],
|
|
10
|
+
});
|
|
24
11
|
};
|
|
25
12
|
exports.up = up;
|
|
26
13
|
const down = async ({ context }) => {
|
|
@@ -4,35 +4,18 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
allowNull: true,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
if (!tableDescriptions?.messageId) {
|
|
23
|
-
await queryInterface.addColumn('projects', 'messageId', {
|
|
24
|
-
type: sequelize_1.DataTypes.STRING(80),
|
|
25
|
-
allowNull: true,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
31
|
-
// ignore
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
throw err;
|
|
35
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'tenantScope', {
|
|
8
|
+
type: sequelize_1.DataTypes.STRING(80),
|
|
9
|
+
allowNull: true,
|
|
10
|
+
});
|
|
11
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'createdBy', {
|
|
12
|
+
type: sequelize_1.DataTypes.STRING(80),
|
|
13
|
+
allowNull: true,
|
|
14
|
+
});
|
|
15
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'messageId', {
|
|
16
|
+
type: sequelize_1.DataTypes.STRING(80),
|
|
17
|
+
allowNull: true,
|
|
18
|
+
});
|
|
36
19
|
};
|
|
37
20
|
exports.up = up;
|
|
38
21
|
const down = async ({ context }) => {
|
|
@@ -4,23 +4,10 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
await queryInterface.addColumn('releases', 'uploadedResource', {
|
|
12
|
-
type: sequelize_1.DataTypes.STRING(255),
|
|
13
|
-
allowNull: true,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
19
|
-
// ignore
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
throw err;
|
|
23
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'uploadedResource', {
|
|
8
|
+
type: sequelize_1.DataTypes.STRING(255),
|
|
9
|
+
allowNull: true,
|
|
10
|
+
});
|
|
24
11
|
};
|
|
25
12
|
exports.up = up;
|
|
26
13
|
const down = async ({ context }) => {
|
|
@@ -4,31 +4,16 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (!tableDescriptions?.possibleSameStore) {
|
|
18
|
-
await queryInterface.addColumn('projects', 'possibleSameStore', {
|
|
19
|
-
type: sequelize_1.DataTypes.BOOLEAN,
|
|
20
|
-
allowNull: false,
|
|
21
|
-
defaultValue: false,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
27
|
-
// ignore
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
throw err;
|
|
31
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'autoUpload', {
|
|
8
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
9
|
+
allowNull: false,
|
|
10
|
+
defaultValue: false,
|
|
11
|
+
});
|
|
12
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'projects', 'possibleSameStore', {
|
|
13
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
14
|
+
allowNull: false,
|
|
15
|
+
defaultValue: false,
|
|
16
|
+
});
|
|
32
17
|
};
|
|
33
18
|
exports.up = up;
|
|
34
19
|
const down = async ({ context }) => {
|
|
@@ -2,20 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.down = exports.up = void 0;
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
|
-
const models_1 = require("../../models");
|
|
6
5
|
const migrate_1 = require("../../migrate");
|
|
7
6
|
const up = async ({ context }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'users', 'phone', {
|
|
8
|
+
type: sequelize_1.DataTypes.STRING(36),
|
|
9
|
+
allowNull: true,
|
|
10
|
+
});
|
|
14
11
|
};
|
|
15
12
|
exports.up = up;
|
|
16
13
|
const down = async ({ context }) => {
|
|
17
|
-
|
|
18
|
-
await (0, migrate_1.removeColumnIfExists)(context, 'users', 'phone');
|
|
19
|
-
}
|
|
14
|
+
await (0, migrate_1.removeColumnIfExists)(context, 'users', 'phone');
|
|
20
15
|
};
|
|
21
16
|
exports.down = down;
|
|
@@ -4,7 +4,7 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
await
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'users', 'inviter', {
|
|
8
8
|
type: sequelize_1.DataTypes.STRING(80),
|
|
9
9
|
allowNull: true,
|
|
10
10
|
});
|
|
@@ -4,38 +4,21 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
if (!tableDescriptions?.blockletCommunity) {
|
|
25
|
-
await queryInterface.addColumn('releases', 'blockletCommunity', {
|
|
26
|
-
type: sequelize_1.DataTypes.STRING(255),
|
|
27
|
-
defaultValue: '',
|
|
28
|
-
allowNull: true,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
34
|
-
// ignore
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
throw err;
|
|
38
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'blockletHomepage', {
|
|
8
|
+
type: sequelize_1.DataTypes.STRING(255),
|
|
9
|
+
defaultValue: '',
|
|
10
|
+
allowNull: true,
|
|
11
|
+
});
|
|
12
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'blockletSupport', {
|
|
13
|
+
type: sequelize_1.DataTypes.STRING(255),
|
|
14
|
+
defaultValue: '',
|
|
15
|
+
allowNull: true,
|
|
16
|
+
});
|
|
17
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'blockletCommunity', {
|
|
18
|
+
type: sequelize_1.DataTypes.STRING(255),
|
|
19
|
+
defaultValue: '',
|
|
20
|
+
allowNull: true,
|
|
21
|
+
});
|
|
39
22
|
};
|
|
40
23
|
exports.up = up;
|
|
41
24
|
const down = async ({ context }) => {
|
|
@@ -4,24 +4,11 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const migrate_1 = require("../../migrate");
|
|
5
5
|
const util_1 = require("../../util");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type: (0, util_1.JSONOrJSONB)(),
|
|
13
|
-
defaultValue: [],
|
|
14
|
-
allowNull: true,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
20
|
-
// ignore
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
throw err;
|
|
24
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'blockletVideos', {
|
|
8
|
+
type: (0, util_1.JSONOrJSONB)(),
|
|
9
|
+
defaultValue: [],
|
|
10
|
+
allowNull: true,
|
|
11
|
+
});
|
|
25
12
|
};
|
|
26
13
|
exports.up = up;
|
|
27
14
|
const down = async ({ context }) => {
|
|
@@ -36,52 +36,48 @@ const columnsToAdd = () => {
|
|
|
36
36
|
};
|
|
37
37
|
// eslint-disable-next-line import/prefer-default-export
|
|
38
38
|
const up = async ({ context }) => {
|
|
39
|
-
await
|
|
39
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'receiver', {
|
|
40
40
|
type: sequelize_1.DataTypes.STRING(80),
|
|
41
41
|
allowNull: true, // 修改为允许空值
|
|
42
42
|
});
|
|
43
|
-
await
|
|
43
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'action', {
|
|
44
44
|
type: sequelize_1.DataTypes.STRING(255),
|
|
45
45
|
allowNull: true, // 修改为允许空值
|
|
46
46
|
});
|
|
47
|
-
await
|
|
47
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'entityType', {
|
|
48
48
|
type: sequelize_1.DataTypes.STRING(32),
|
|
49
49
|
allowNull: true, // 修改为允许空值
|
|
50
50
|
});
|
|
51
|
-
await
|
|
51
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'entityId', {
|
|
52
52
|
type: sequelize_1.DataTypes.STRING(80),
|
|
53
53
|
allowNull: true, // 修改为允许空值
|
|
54
54
|
});
|
|
55
55
|
// 冗余字段
|
|
56
56
|
await (0, migrate_1.removeColumnIfExists)(context, 'notifications', 'updatedAt');
|
|
57
|
-
const tableDescriptions = await context.describeTable('notifications');
|
|
58
|
-
const promises = [];
|
|
59
57
|
for (const [columnName, columnDefinition] of Object.entries(columnsToAdd())) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
58
|
+
// eslint-disable-next-line no-await-in-loop
|
|
59
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'notifications', columnName, columnDefinition);
|
|
63
60
|
}
|
|
64
|
-
await Promise.all(promises);
|
|
65
61
|
};
|
|
66
62
|
exports.up = up;
|
|
67
63
|
const down = async ({ context }) => {
|
|
68
|
-
await
|
|
64
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'receiver', {
|
|
69
65
|
type: sequelize_1.DataTypes.STRING(80),
|
|
70
66
|
allowNull: false, // 修改为允许空值
|
|
71
67
|
});
|
|
72
|
-
await
|
|
68
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'action', {
|
|
73
69
|
type: sequelize_1.DataTypes.STRING(255),
|
|
74
70
|
allowNull: false, // 修改为允许空值
|
|
75
71
|
});
|
|
76
|
-
await
|
|
72
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'entityType', {
|
|
77
73
|
type: sequelize_1.DataTypes.STRING(32),
|
|
78
74
|
allowNull: false, // 修改为允许空值
|
|
79
75
|
});
|
|
80
|
-
await
|
|
76
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'entityId', {
|
|
81
77
|
type: sequelize_1.DataTypes.STRING(80),
|
|
82
78
|
allowNull: false, // 修改为允许空值
|
|
83
79
|
});
|
|
84
|
-
await
|
|
80
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'notifications', 'updatedAt', {
|
|
85
81
|
type: sequelize_1.DataTypes.DATE,
|
|
86
82
|
defaultValue: sequelize_1.DataTypes.NOW,
|
|
87
83
|
});
|
|
@@ -4,24 +4,11 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type: sequelize_1.DataTypes.STRING(255),
|
|
13
|
-
defaultValue: '',
|
|
14
|
-
allowNull: true,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
20
|
-
// ignore
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
throw err;
|
|
24
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'blockletRepository', {
|
|
8
|
+
type: sequelize_1.DataTypes.STRING(255),
|
|
9
|
+
defaultValue: '',
|
|
10
|
+
allowNull: true,
|
|
11
|
+
});
|
|
25
12
|
};
|
|
26
13
|
exports.up = up;
|
|
27
14
|
const down = async ({ context }) => {
|
|
@@ -5,31 +5,16 @@ const sequelize_1 = require("sequelize");
|
|
|
5
5
|
const migrate_1 = require("../../migrate");
|
|
6
6
|
const util_1 = require("../../util");
|
|
7
7
|
const up = async ({ context }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (!tableDescriptions?.contentType) {
|
|
19
|
-
await queryInterface.addColumn('releases', 'contentType', {
|
|
20
|
-
type: sequelize_1.DataTypes.STRING(255),
|
|
21
|
-
defaultValue: '',
|
|
22
|
-
allowNull: true,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
28
|
-
// ignore
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
throw err;
|
|
32
|
-
}
|
|
8
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'blockletDocker', {
|
|
9
|
+
type: (0, util_1.JSONOrJSONB)(),
|
|
10
|
+
defaultValue: '',
|
|
11
|
+
allowNull: true,
|
|
12
|
+
});
|
|
13
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'releases', 'contentType', {
|
|
14
|
+
type: sequelize_1.DataTypes.STRING(255),
|
|
15
|
+
defaultValue: '',
|
|
16
|
+
allowNull: true,
|
|
17
|
+
});
|
|
33
18
|
};
|
|
34
19
|
exports.up = up;
|
|
35
20
|
const down = async ({ context }) => {
|
|
@@ -18,22 +18,18 @@ const columnsToAdd = () => {
|
|
|
18
18
|
};
|
|
19
19
|
// eslint-disable-next-line import/prefer-default-export
|
|
20
20
|
const up = async ({ context }) => {
|
|
21
|
-
await
|
|
21
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'description', {
|
|
22
22
|
type: sequelize_1.DataTypes.TEXT,
|
|
23
23
|
allowNull: true, // 修改为允许空值
|
|
24
24
|
});
|
|
25
|
-
const tableDescriptions = await context.describeTable('notifications');
|
|
26
|
-
const promises = [];
|
|
27
25
|
for (const [columnName, columnDefinition] of Object.entries(columnsToAdd())) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
26
|
+
// eslint-disable-next-line no-await-in-loop
|
|
27
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'notifications', columnName, columnDefinition);
|
|
31
28
|
}
|
|
32
|
-
await Promise.all(promises);
|
|
33
29
|
};
|
|
34
30
|
exports.up = up;
|
|
35
31
|
const down = async ({ context }) => {
|
|
36
|
-
await
|
|
32
|
+
await (0, migrate_1.changeColumnIfExists)(context, 'notifications', 'description', {
|
|
37
33
|
type: sequelize_1.DataTypes.TEXT,
|
|
38
34
|
allowNull: false,
|
|
39
35
|
});
|
|
@@ -2,28 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.down = exports.up = void 0;
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
|
-
const models_1 = require("../../models");
|
|
6
5
|
const migrate_1 = require("../../migrate");
|
|
7
6
|
const up = async ({ context }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
await context.addColumn('sessions', 'challenge', {
|
|
16
|
-
type: sequelize_1.DataTypes.STRING(64),
|
|
17
|
-
});
|
|
18
|
-
}
|
|
7
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'connected_accounts', 'counter', {
|
|
8
|
+
type: sequelize_1.DataTypes.BIGINT,
|
|
9
|
+
defaultValue: 0,
|
|
10
|
+
});
|
|
11
|
+
await (0, migrate_1.addColumnIfNotExists)(context, 'sessions', 'challenge', {
|
|
12
|
+
type: sequelize_1.DataTypes.STRING(64),
|
|
13
|
+
});
|
|
19
14
|
};
|
|
20
15
|
exports.up = up;
|
|
21
16
|
const down = async ({ context }) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
if (await (0, models_1.existsColumn)(context, 'sessions', 'challenge')) {
|
|
26
|
-
await (0, migrate_1.removeColumnIfExists)(context, 'sessions', 'challenge');
|
|
27
|
-
}
|
|
17
|
+
await (0, migrate_1.removeColumnIfExists)(context, 'connected_accounts', 'counter');
|
|
18
|
+
await (0, migrate_1.removeColumnIfExists)(context, 'sessions', 'challenge');
|
|
28
19
|
};
|
|
29
20
|
exports.down = down;
|