@itrocks/mysql-maintainer 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -84,9 +84,11 @@ For example, a read follows this simplified sequence:
84
84
  The exported classes that implement context tracking, error handling, schema updates, and retries are internal
85
85
  mechanics of this integration. They are not a separate API that an application needs to call.
86
86
 
87
- Unique indexes declared with `@Unique` are checked before the first insert or update of each persistent class on a
88
- database connection. This lazy preflight also detects an index added to a class after its table already exists. Writes
89
- of the same class on the same connection share one preflight, and a new connection performs the check again.
87
+ Unique indexes declared with `@Unique` from
88
+ [`@itrocks/unique`](https://github.com/itrocks-ts/unique) are checked before the first insert or update of each
89
+ persistent class on a database connection. This lazy preflight also detects an index added to a class after its table
90
+ already exists. Writes of the same class on the same connection share one preflight, and a new connection performs the
91
+ check again.
90
92
 
91
93
  If existing duplicate rows prevent a unique index from being created, the maintainer does not alter or delete those
92
94
  rows. It rejects the write with a generic `UniqueIndexMaintenanceError`. Operational logs contain only a fixed event
package/cjs/mysql.js CHANGED
@@ -5,7 +5,7 @@ const class_type_1 = require("@itrocks/class-type");
5
5
  const mysql_1 = require("@itrocks/mysql");
6
6
  const reflect_1 = require("@itrocks/reflect");
7
7
  const reflect_2 = require("@itrocks/reflect");
8
- const store_1 = require("@itrocks/store");
8
+ const unique_1 = require("@itrocks/unique");
9
9
  const contextual_connection_1 = require("./contextual-connection");
10
10
  const mysql_maintainer_1 = require("./mysql-maintainer");
11
11
  const safe_error_code_1 = require("./safe-error-code");
@@ -52,7 +52,7 @@ class Mysql extends mysql_1.Mysql {
52
52
  return maintenance;
53
53
  }
54
54
  hasUniqueIndexes(type) {
55
- return new reflect_1.ReflectClass(type).properties.some(property => (0, store_1.uniqueOf)(type, property.name) !== false);
55
+ return new reflect_1.ReflectClass(type).properties.some(property => (0, unique_1.uniqueOf)(type, property.name) !== false);
56
56
  }
57
57
  async insert(object) {
58
58
  return this.withContext(object, async () => {
package/package.json CHANGED
@@ -11,8 +11,10 @@
11
11
  "@itrocks/reflect-to-schema": "latest",
12
12
  "@itrocks/schema-diff": "latest",
13
13
  "@itrocks/schema-diff-mysql": "latest",
14
+ "@itrocks/schema-to-mysql": "latest",
14
15
  "@itrocks/storage": "latest",
15
16
  "@itrocks/store": "latest",
17
+ "@itrocks/unique": "latest",
16
18
  "mariadb": "^3.4"
17
19
  },
18
20
  "description": "Reactively maintains database structure by updating schema and retrying on MySQL errors",
@@ -56,5 +58,5 @@
56
58
  "test": "npm run build && node --test \"test/**/*.test.mjs\"",
57
59
  "test:integration": "npm run build && node --test \"test/**/*.integration.mjs\""
58
60
  },
59
- "version": "0.3.1"
61
+ "version": "0.3.3"
60
62
  }