@nocobase/database 0.19.0-alpha.2 → 0.19.0-alpha.4

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.
Files changed (2) hide show
  1. package/lib/database.js +23 -11
  2. package/package.json +4 -4
package/lib/database.js CHANGED
@@ -590,14 +590,16 @@ const _Database = class _Database extends import_events.EventEmitter {
590
590
  const authenticate = /* @__PURE__ */ __name(async () => {
591
591
  try {
592
592
  await this.sequelize.authenticate(others);
593
- this.logger.info("Connection has been established successfully.", { method: "auth" });
593
+ this.logger.info("connection has been established successfully.", { method: "auth" });
594
594
  } catch (error) {
595
- this.logger.warn(`Attempt ${attemptNumber}/${retry}: Unable to connect to the database: ${error.message}`, {
595
+ this.logger.warn(`attempt ${attemptNumber}/${retry}: Unable to connect to the database: ${error.message}`, {
596
596
  method: "auth"
597
597
  });
598
598
  const nextDelay = startingDelay * Math.pow(timeMultiple, attemptNumber - 1);
599
- this.logger.warn(`Will retry in ${nextDelay}ms...`, { method: "auth" });
600
599
  attemptNumber++;
600
+ if (attemptNumber < retry) {
601
+ this.logger.warn(`will retry in ${nextDelay}ms...`, { method: "auth" });
602
+ }
601
603
  throw error;
602
604
  }
603
605
  }, "authenticate");
@@ -702,20 +704,30 @@ const _Database = class _Database extends import_events.EventEmitter {
702
704
  return;
703
705
  },
704
706
  async onDump(dumper, collection) {
705
- const viewDef = await collection.db.queryInterface.viewDef(collection.getTableNameWithSchemaAsString());
706
- dumper.writeSQLContent(`view-${collection.name}`, {
707
- sql: [
708
- `DROP VIEW IF EXISTS ${collection.getTableNameWithSchemaAsString()}`,
709
- `CREATE VIEW ${collection.getTableNameWithSchemaAsString()} AS ${viewDef}`
710
- ],
711
- group: "required"
712
- });
707
+ try {
708
+ const viewDef = await collection.db.queryInterface.viewDef(collection.getTableNameWithSchemaAsString());
709
+ dumper.writeSQLContent(`view-${collection.name}`, {
710
+ sql: [
711
+ `DROP VIEW IF EXISTS ${collection.getTableNameWithSchemaAsString()}`,
712
+ `CREATE VIEW ${collection.getTableNameWithSchemaAsString()} AS ${viewDef}`
713
+ ],
714
+ group: "required"
715
+ });
716
+ } catch (e) {
717
+ return;
718
+ }
713
719
  return;
714
720
  }
715
721
  });
716
722
  this.collectionFactory.registerCollectionType(import_sql_collection.SqlCollection, {
717
723
  condition: (options) => {
718
724
  return options.sql;
725
+ },
726
+ async onSync() {
727
+ return;
728
+ },
729
+ async onDump(dumper, collection) {
730
+ return;
719
731
  }
720
732
  });
721
733
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "0.19.0-alpha.2",
3
+ "version": "0.19.0-alpha.4",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "Apache-2.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "0.19.0-alpha.2",
10
- "@nocobase/utils": "0.19.0-alpha.2",
9
+ "@nocobase/logger": "0.19.0-alpha.4",
10
+ "@nocobase/utils": "0.19.0-alpha.4",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -35,5 +35,5 @@
35
35
  "url": "git+https://github.com/nocobase/nocobase.git",
36
36
  "directory": "packages/database"
37
37
  },
38
- "gitHead": "cff5b77ecf12ccdb450d50d505b3aa44a68478c8"
38
+ "gitHead": "9583023f7bea828da5192384a5c002782c341b65"
39
39
  }