@drzl/analyzer 1.21.2 → 1.21.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.
package/dist/index.cjs CHANGED
@@ -1360,6 +1360,7 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
1360
1360
  if (dialect === "sqlite") {
1361
1361
  for (const view of viewTables) view.readOnly = true;
1362
1362
  }
1363
+ for (const t of tables) t.dialect = dialect;
1363
1364
  if (dialect === "unknown" && tables.length) {
1364
1365
  issues.push({
1365
1366
  code: "DRZL_ANL_DIALECT",
package/dist/index.d.cts CHANGED
@@ -156,11 +156,34 @@ interface Column {
156
156
  * `declaredDecimalRange` reads both numbers now, the two are distinguishable, and each says what
157
157
  * its own server does.
158
158
  *
159
- * Postgres and Gel. MySQL refuses all three on a `float`/`double`, and on a `decimal` refuses
160
- * them outright rather than storing `0.00`: measured on MySQL 8.4.11 in `STRICT_TRANS_TABLES`,
161
- * all three answer `Incorrect decimal value`. SQLite returns both infinities and silently turns
162
- * `NaN` into NULL, which is real and is filed on its own: a column needs both halves of that
163
- * answer or none.
159
+ * Postgres and Gel. MySQL is a `false` on every one of these, and the reason is worth writing
160
+ * down carefully, because the two client paths give different answers and only one of them is
161
+ * the path a driver takes.
162
+ *
163
+ * Measured on MySQL 8.4.11 in `STRICT_TRANS_TABLES`, through mysql2's `execute()`, which is the
164
+ * binary prepared path drizzle uses:
165
+ *
166
+ * float, double all three refused, `Out of range value`
167
+ * decimal(10,2) all three STORED AS 0.00, silently, `SHOW WARNINGS` empty
168
+ * int `NaN` stored as 0 silently; both infinities refused
169
+ * bigint `NaN` stored as the int64 minimum silently; both infinities refused
170
+ *
171
+ * A control rules out ordinary overflow as the explanation: a finite `1e308` into the same
172
+ * `decimal(10,2)` is refused. So on three of those five, the server takes the row and stores a
173
+ * number nobody sent. This comment used to say a decimal "refuses them outright", which is the
174
+ * *text* path's answer: through the `mysql` CLI the same value answers `Incorrect decimal value`.
175
+ * Both statements are true of their own path, and only one of them describes what a validator
176
+ * sits in front of.
177
+ *
178
+ * The flag stays `false` on all of them, so the emitted schemas refuse all three. That is
179
+ * deliberately not the "never be stricter than the server" rule the range work follows: the
180
+ * server is not accepting the value here, it is accepting the row and storing a different value,
181
+ * and a validator whose whole job is to say what the database will do with a write cannot call
182
+ * that acceptance. Nothing is lost either way, since every generator's plain number type already
183
+ * refuses the three.
184
+ *
185
+ * SQLite returns both infinities and silently turns `NaN` into NULL, which is real and is filed
186
+ * on its own: a column needs both halves of that answer or none.
164
187
  *
165
188
  * Gel joined on a measurement of its own rather than on being Postgres-backed: a live Gel 7.1
166
189
  * stored `nan`, `inf` and `-inf` in both `std::float32` and `std::float64` and handed all three
@@ -360,6 +383,16 @@ interface ForeignKey {
360
383
  interface Table {
361
384
  name: string;
362
385
  tsName: string;
386
+ /**
387
+ * The engine this table was declared for, repeated from the `Analysis` that holds it.
388
+ *
389
+ * Duplication on purpose, and the same kind `Column` already carries: `maxBytes`, `allowsNaN` and
390
+ * `format` are all dialect-derived facts stamped onto the column so nothing downstream has to
391
+ * know which server it is looking at. The shared check helpers take a `Table` rather than an
392
+ * `Analysis`, and one thing they cannot read correctly without the engine is `length()`, which
393
+ * counts characters on Postgres and SQLite and BYTES on MySQL.
394
+ */
395
+ dialect?: Dialect;
363
396
  /**
364
397
  * The SQL schema the table was declared in, from `pgSchema('reporting').table(...)` and the
365
398
  * MySQL and SingleStore equivalents. Absent for a table declared with plain `pgTable`, which is
package/dist/index.d.ts CHANGED
@@ -156,11 +156,34 @@ interface Column {
156
156
  * `declaredDecimalRange` reads both numbers now, the two are distinguishable, and each says what
157
157
  * its own server does.
158
158
  *
159
- * Postgres and Gel. MySQL refuses all three on a `float`/`double`, and on a `decimal` refuses
160
- * them outright rather than storing `0.00`: measured on MySQL 8.4.11 in `STRICT_TRANS_TABLES`,
161
- * all three answer `Incorrect decimal value`. SQLite returns both infinities and silently turns
162
- * `NaN` into NULL, which is real and is filed on its own: a column needs both halves of that
163
- * answer or none.
159
+ * Postgres and Gel. MySQL is a `false` on every one of these, and the reason is worth writing
160
+ * down carefully, because the two client paths give different answers and only one of them is
161
+ * the path a driver takes.
162
+ *
163
+ * Measured on MySQL 8.4.11 in `STRICT_TRANS_TABLES`, through mysql2's `execute()`, which is the
164
+ * binary prepared path drizzle uses:
165
+ *
166
+ * float, double all three refused, `Out of range value`
167
+ * decimal(10,2) all three STORED AS 0.00, silently, `SHOW WARNINGS` empty
168
+ * int `NaN` stored as 0 silently; both infinities refused
169
+ * bigint `NaN` stored as the int64 minimum silently; both infinities refused
170
+ *
171
+ * A control rules out ordinary overflow as the explanation: a finite `1e308` into the same
172
+ * `decimal(10,2)` is refused. So on three of those five, the server takes the row and stores a
173
+ * number nobody sent. This comment used to say a decimal "refuses them outright", which is the
174
+ * *text* path's answer: through the `mysql` CLI the same value answers `Incorrect decimal value`.
175
+ * Both statements are true of their own path, and only one of them describes what a validator
176
+ * sits in front of.
177
+ *
178
+ * The flag stays `false` on all of them, so the emitted schemas refuse all three. That is
179
+ * deliberately not the "never be stricter than the server" rule the range work follows: the
180
+ * server is not accepting the value here, it is accepting the row and storing a different value,
181
+ * and a validator whose whole job is to say what the database will do with a write cannot call
182
+ * that acceptance. Nothing is lost either way, since every generator's plain number type already
183
+ * refuses the three.
184
+ *
185
+ * SQLite returns both infinities and silently turns `NaN` into NULL, which is real and is filed
186
+ * on its own: a column needs both halves of that answer or none.
164
187
  *
165
188
  * Gel joined on a measurement of its own rather than on being Postgres-backed: a live Gel 7.1
166
189
  * stored `nan`, `inf` and `-inf` in both `std::float32` and `std::float64` and handed all three
@@ -360,6 +383,16 @@ interface ForeignKey {
360
383
  interface Table {
361
384
  name: string;
362
385
  tsName: string;
386
+ /**
387
+ * The engine this table was declared for, repeated from the `Analysis` that holds it.
388
+ *
389
+ * Duplication on purpose, and the same kind `Column` already carries: `maxBytes`, `allowsNaN` and
390
+ * `format` are all dialect-derived facts stamped onto the column so nothing downstream has to
391
+ * know which server it is looking at. The shared check helpers take a `Table` rather than an
392
+ * `Analysis`, and one thing they cannot read correctly without the engine is `length()`, which
393
+ * counts characters on Postgres and SQLite and BYTES on MySQL.
394
+ */
395
+ dialect?: Dialect;
363
396
  /**
364
397
  * The SQL schema the table was declared in, from `pgSchema('reporting').table(...)` and the
365
398
  * MySQL and SingleStore equivalents. Absent for a table declared with plain `pgTable`, which is
package/dist/index.js CHANGED
@@ -1317,6 +1317,7 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
1317
1317
  if (dialect === "sqlite") {
1318
1318
  for (const view of viewTables) view.readOnly = true;
1319
1319
  }
1320
+ for (const t of tables) t.dialect = dialect;
1320
1321
  if (dialect === "unknown" && tables.length) {
1321
1322
  issues.push({
1322
1323
  code: "DRZL_ANL_DIALECT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drzl/analyzer",
3
- "version": "1.21.2",
3
+ "version": "1.21.4",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",