@abtnode/models 1.16.31-beta-4246ab25 → 1.16.31-beta-a0cc72cf

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,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.down = exports.up = void 0;
4
+ const up = async ({ context }) => {
5
+ try {
6
+ await context.addIndex('users', ['lastLoginAt']);
7
+ await context.addIndex('users', ['inviter']);
8
+ await context.addIndex('tagging', ['taggableType', 'taggableId']);
9
+ await context.addIndex('user_sessions', ['userDid', 'status']);
10
+ await context.addIndex('notifications', ['createdAt']);
11
+ await context.addIndex('permissions', ['type', 'createdAt']);
12
+ await context.addIndex('projects', ['createdAt']);
13
+ await context.addIndex('projects', ['createdBy']);
14
+ await context.addIndex('projects', ['createdBy', 'createdAt']);
15
+ await context.addIndex('releases', ['createdAt']);
16
+ await context.addIndex('releases', ['projectId']);
17
+ await context.addIndex('releases', ['projectId', 'createdAt']);
18
+ }
19
+ catch (err) {
20
+ console.error('Failed to add blocklet indexes', err);
21
+ }
22
+ };
23
+ exports.up = up;
24
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
+ const down = async ({ context }) => { };
26
+ exports.down = down;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.down = exports.up = void 0;
4
+ const up = async ({ context }) => {
5
+ try {
6
+ await context.addIndex('blocklets', ['createdAt']);
7
+ await context.addIndex('blocklets', ['structV1Did']);
8
+ await context.addIndex('sites', ['domain']);
9
+ await context.addIndex('users', ['lastLoginAt']);
10
+ await context.addIndex('users', ['inviter']);
11
+ await context.addIndex('tagging', ['taggableType', 'taggableId']);
12
+ await context.addIndex('audit_logs', ['scope', 'createdAt']);
13
+ await context.addIndex('audit_logs', ['createdAt']);
14
+ await context.addIndex('backups', ['appPid', 'createdAt']);
15
+ await context.addIndex('notifications', ['createdAt']);
16
+ await context.addIndex('permissions', ['type', 'createdAt']);
17
+ await context.sequelize.query("CREATE INDEX blocklets_meta_did ON `blocklets` ((json_extract(`meta`, '$.did')));");
18
+ }
19
+ catch (err) {
20
+ console.error('Failed to add server indexes', err);
21
+ }
22
+ };
23
+ exports.up = up;
24
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
+ const down = async ({ context }) => { };
26
+ exports.down = down;
@@ -82,10 +82,12 @@ __exportStar(require("./traffic-insight"), exports);
82
82
  __exportStar(require("./runtime-insight"), exports);
83
83
  __exportStar(require("./tag"), exports);
84
84
  __exportStar(require("./tagging"), exports);
85
+ const logEnabled = !process.env.DISABLE_SQLITE_LOG &&
86
+ (process.env.DEBUG === '@abtnode/models' || ['production', 'test'].includes(process.env.NODE_ENV) === false);
85
87
  const instances = new Map();
86
88
  function createSequelize(dbPath, config = {
87
- logging: !process.env.DISABLE_SQLITE_LOG &&
88
- (process.env.DEBUG === '@abtnode/models' || ['production', 'test'].includes(process.env.NODE_ENV) === false),
89
+ benchmark: logEnabled,
90
+ logging: logEnabled,
89
91
  }) {
90
92
  if (instances.has(dbPath)) {
91
93
  return instances.get(dbPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/models",
3
- "version": "1.16.31-beta-4246ab25",
3
+ "version": "1.16.31-beta-a0cc72cf",
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,8 +33,8 @@
33
33
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@abtnode/logger": "1.16.31-beta-4246ab25",
37
- "@abtnode/types": "1.16.31-beta-4246ab25",
36
+ "@abtnode/logger": "1.16.31-beta-a0cc72cf",
37
+ "@abtnode/types": "1.16.31-beta-a0cc72cf",
38
38
  "lodash.clonedeep": "^4.5.0",
39
39
  "lodash.isempty": "^4.4.0",
40
40
  "sequelize": "^6.35.0",
@@ -54,5 +54,5 @@
54
54
  "typescript": "^5.0.4"
55
55
  },
56
56
  "resolutions": {},
57
- "gitHead": "ef93705b89033e4cd5fed458b64521d0a994a1d0"
57
+ "gitHead": "d1eec814979a4086fc5efd7c719687b76c972ec6"
58
58
  }