@bakery-framework/orm 2.0.0-rc.1 → 2.0.0-rc.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/field.ts +21 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakery-framework/orm",
3
- "version": "2.0.0-rc.1",
3
+ "version": "2.0.0-rc.3",
4
4
  "description": "Bakery database layer: adapters, query builder, schema sync and backup.",
5
5
  "keywords": [
6
6
  "bakery",
@@ -54,6 +54,6 @@
54
54
  "bun": ">=1.4.0"
55
55
  },
56
56
  "dependencies": {
57
- "@bakery-framework/core": "^2.0.0-rc.1"
57
+ "@bakery-framework/core": "^2.0.0-rc.3"
58
58
  }
59
59
  }
package/src/field.ts CHANGED
@@ -236,9 +236,18 @@ export const Field = {
236
236
  * the declared type verbatim and reads it back, so one schema round-trips on
237
237
  * all three.
238
238
  *
239
- * `length` is not part of the column diff, so **widening a Varchar does not
240
- * migrate on its own**; see `ColumnConstraint.length` for why that is
241
- * deliberate rather than missing.
239
+ * **`length` *is* part of the column diff** (`sync/diff.ts`), so adopting
240
+ * `Varchar` on an existing table rebuilds it once. That is deliberate and
241
+ * it converges: all three dialects report a VARCHAR width back exactly, so
242
+ * after one rebuild the two agree and the table stays synced. A column that
243
+ * reports no width really is unsized, and a schema that declares no width
244
+ * asks for nothing.
245
+ *
246
+ * This comment claimed the opposite until 2026-09-20, and it is the comment
247
+ * a schema author reads when deciding whether the change is safe. Measured
248
+ * on a real app: switching 12 tables' text columns to `Varchar` moved
249
+ * `db:sync` from "perfectly synced" to a 12-table rebuild, and the second
250
+ * sync was clean.
242
251
  */
243
252
  Varchar: <D extends string | null | undefined = undefined>(
244
253
  length: number,
@@ -500,9 +509,15 @@ export const Field = {
500
509
  * an app that behaves differently depending on where it runs, which is worse
501
510
  * than either choice made consistently.
502
511
  *
503
- * The members are **not part of the column diff**. See
504
- * `ColumnConstraint._enum`. Adding or removing one does not migrate on its
505
- * own; the table has to be rebuilt for the CHECK to change.
512
+ * **The members join the column diff when the current state came from the
513
+ * ledger**, so changing them migrates rather than silently doing nothing.
514
+ * Under introspection they stay out of it, because all three dialects
515
+ * report a CHECK back in a different shape and Postgres re-renders it
516
+ * entirely: three parsers, three chances to rebuild the table on every sync
517
+ * forever. `sync/diff.ts` has the measured shapes.
518
+ *
519
+ * So adopting `Enum` on an existing ledger-tracked table rebuilds it once.
520
+ * This comment said the members were never diffed until 2026-09-20.
506
521
  */
507
522
  Enum: <
508
523
  const V extends EnumSource,