@owlmeans/postgres-resource 0.1.18-rc.7 → 0.1.18-rc.9

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/postgres-resource",
4
- "version": "0.1.18-rc.6",
5
- "generatedAt": "2026-08-18T14:48:00.528Z",
4
+ "version": "0.1.18-rc.8",
5
+ "generatedAt": "2026-08-24T21:14:00.129Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/postgres-resource
9
9
 
10
10
  **Layer:** Infra
11
- **Install:** `"@owlmeans/postgres-resource": "^0.1.18-rc.6"` in `dependencies` (peers `pg`, `ajv`)
11
+ **Install:** `"@owlmeans/postgres-resource": "^0.1.18-rc.8"` in `dependencies` (peers `pg`, `ajv`)
12
12
 
13
13
  The Postgres counterpart of [[mongo-resource]]. The difference that governs everything else: a
14
14
  Mongo collection has no structure, a Postgres table does — so **the resource layer owns the DDL**
@@ -108,6 +108,16 @@ boot once with `Additive`, confirm the plan comes out empty, then flip to `Full`
108
108
  `pg.unmanaged` stay outside reconciliation's authority permanently. A cast Postgres cannot perform
109
109
  raises `PostgresCastRequired` instead of truncating.
110
110
 
111
+ **A retype drops the column's default first and restores it after.** Postgres refuses
112
+ `ALTER COLUMN … TYPE` outright when the column carries a DEFAULT it cannot cast to the new type
113
+ (`42804 default for column "x" cannot be cast automatically`), and it refuses before reading a
114
+ single row, so `USING` never gets a chance to help. Since the plan is one transaction, that refusal
115
+ aborts the whole reconciliation and the resource then fails *every* boot with an error naming the
116
+ column it is trying to fix. The plan therefore emits `DROP DEFAULT` → `ALTER … TYPE … USING` →
117
+ `SET DEFAULT`, restoring the default from the spec rather than from what the column was carrying.
118
+ The `id` column is where this shows up in practice: it is created with a `gen_random_uuid()::text`
119
+ default, so any change to its declared type takes this path.
120
+
111
121
  ## Migrations bracket the sync
112
122
 
113
123
  `migration`/`migrations()` implement the shared `MigratableResource` capability from
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/postgres-resource",
3
- "version": "0.1.18-rc.7",
3
+ "version": "0.1.18-rc.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -27,17 +27,17 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@noble/hashes": "^1.5.0",
30
- "@owlmeans/basic-ids": "^0.1.18-rc.6",
30
+ "@owlmeans/basic-ids": "^0.1.18-rc.7",
31
31
  "@owlmeans/context": "^0.1.18-rc.6",
32
- "@owlmeans/resource": "^0.1.18-rc.6",
33
- "@owlmeans/server-context": "^0.1.18-rc.6",
32
+ "@owlmeans/resource": "^0.1.18-rc.7",
33
+ "@owlmeans/server-context": "^0.1.18-rc.8",
34
34
  "@scure/base": "^2.3.0",
35
35
  "drizzle-orm": "~0.45.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@owlmeans/dep-config": "workspace:*",
39
39
  "@owlmeans/test-integration": "^0.1.18-rc.6",
40
- "@types/bun": "^1.3.14",
40
+ "@types/bun": "^1.4.0",
41
41
  "@types/node": "^26.1.0",
42
42
  "@types/pg": "^8.20.4",
43
43
  "nodemon": "^3.1.14",