@abtnode/models 1.16.49 → 1.16.50-beta-20250902-043619-201bcaed
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,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
var _a;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.down = exports.up = void 0;
|
|
8
|
+
const _20250831000000_notifications_1 = __importDefault(require("../common/20250831000000-notifications"));
|
|
9
|
+
_a = (0, _20250831000000_notifications_1.default)(), exports.up = _a.up, exports.down = _a.down;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const models_1 = require("../../models");
|
|
4
|
+
const util_1 = require("../../util");
|
|
5
|
+
const columnsToAdd = () => {
|
|
6
|
+
return {
|
|
7
|
+
options: {
|
|
8
|
+
type: (0, util_1.JSONOrJSONB)(),
|
|
9
|
+
defaultValue: null,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const createNotificationMigration = () => ({
|
|
14
|
+
up: async ({ context }) => {
|
|
15
|
+
const transaction = await context.sequelize.transaction();
|
|
16
|
+
try {
|
|
17
|
+
const promises = [];
|
|
18
|
+
for (const [columnName, columnDefinition] of Object.entries(columnsToAdd())) {
|
|
19
|
+
// eslint-disable-next-line no-await-in-loop
|
|
20
|
+
if (!(await (0, models_1.existsColumn)(context, 'notifications', columnName))) {
|
|
21
|
+
promises.push(context.addColumn('notifications', columnName, columnDefinition, { transaction }));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
await Promise.all(promises);
|
|
25
|
+
await transaction.commit();
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
await transaction.rollback();
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
down: async ({ context }) => {
|
|
33
|
+
const transaction = await context.sequelize.transaction();
|
|
34
|
+
try {
|
|
35
|
+
const promises = [];
|
|
36
|
+
for (const [columnName] of Object.entries(columnsToAdd())) {
|
|
37
|
+
// eslint-disable-next-line no-await-in-loop
|
|
38
|
+
if (await (0, models_1.existsColumn)(context, 'notifications', columnName)) {
|
|
39
|
+
promises.push(context.removeColumn('notifications', columnName, { transaction }));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
await Promise.all(promises);
|
|
43
|
+
await transaction.commit();
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
await transaction.rollback();
|
|
47
|
+
console.error('Migration rollback failed:', error);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
exports.default = createNotificationMigration;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
var _a;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.down = exports.up = void 0;
|
|
8
|
+
const _20250831000000_notifications_1 = __importDefault(require("../common/20250831000000-notifications"));
|
|
9
|
+
_a = (0, _20250831000000_notifications_1.default)(), exports.up = _a.up, exports.down = _a.down;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/models",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.50-beta-20250902-043619-201bcaed",
|
|
4
4
|
"description": "Sequelize models for blocklet server and blocklet service",
|
|
5
5
|
"homepage": "https://github.com/ArcBlock/blocklet-server#readme",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"url": "https://github.com/ArcBlock/blocklet-server/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@abtnode/constant": "1.16.
|
|
37
|
-
"@abtnode/db-cache": "1.16.
|
|
38
|
-
"@abtnode/logger": "1.16.
|
|
39
|
-
"@abtnode/types": "1.16.
|
|
40
|
-
"@abtnode/util": "1.16.
|
|
36
|
+
"@abtnode/constant": "1.16.50-beta-20250902-043619-201bcaed",
|
|
37
|
+
"@abtnode/db-cache": "1.16.50-beta-20250902-043619-201bcaed",
|
|
38
|
+
"@abtnode/logger": "1.16.50-beta-20250902-043619-201bcaed",
|
|
39
|
+
"@abtnode/types": "1.16.50-beta-20250902-043619-201bcaed",
|
|
40
|
+
"@abtnode/util": "1.16.50-beta-20250902-043619-201bcaed",
|
|
41
41
|
"@arcblock/did": "1.24.0",
|
|
42
42
|
"@arcblock/validator": "1.24.0",
|
|
43
43
|
"lodash.clonedeep": "^4.5.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"typescript": "^5.6.3"
|
|
61
61
|
},
|
|
62
62
|
"resolutions": {},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "303555dda4a22370d579651b10886d05688c5533"
|
|
64
64
|
}
|