@rebasepro/server-postgres 0.25.0 → 0.26.0
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/{BranchService-iXXZeVYD.js → BranchService-CWBnDhcv.js} +88 -12
- package/dist/BranchService-CWBnDhcv.js.map +1 -0
- package/dist/PostgresBackendDriver.d.ts +13 -0
- package/dist/PostgresBootstrapper.d.ts +7 -0
- package/dist/auth/services.d.ts +8 -1
- package/dist/auth/verify-auth-tables.d.ts +21 -0
- package/dist/backup/backup-cli.d.ts +40 -3
- package/dist/backup/backup-service.d.ts +11 -0
- package/dist/{backup-service-Bb39plam.js → backup-cli-PoRG-zEq.js} +777 -10
- package/dist/backup-cli-PoRG-zEq.js.map +1 -0
- package/dist/{boot-ddl-s_3Hkz94.js → boot-ddl-EsgqDkx0.js} +3 -3
- package/dist/{boot-ddl-s_3Hkz94.js.map → boot-ddl-EsgqDkx0.js.map} +1 -1
- package/dist/branch-argv.d.ts +15 -0
- package/dist/branch-diff-CxE4VlxT.js +1396 -0
- package/dist/branch-diff-CxE4VlxT.js.map +1 -0
- package/dist/branch-diff-report-DpvVf7hR.js +48 -0
- package/dist/branch-diff-report-DpvVf7hR.js.map +1 -0
- package/dist/branching/branch-diff-report.d.ts +7 -0
- package/dist/branching/branch-diff.d.ts +115 -0
- package/dist/{cli-console-DQ_K-sdM.js → cli-console-f0k6_TsJ.js} +41 -9
- package/dist/cli-console-f0k6_TsJ.js.map +1 -0
- package/dist/cli-console.d.ts +17 -1
- package/dist/{cli-errors-DwQnNATs.js → cli-errors-DsYyNYzd.js} +90 -11
- package/dist/cli-errors-DsYyNYzd.js.map +1 -0
- package/dist/cli-errors.d.ts +14 -0
- package/dist/cli-flags.d.ts +51 -0
- package/dist/{cli-prompt-egtNKkZl.js → cli-prompt-DXG0yk-h.js} +39 -4
- package/dist/{cli-prompt-egtNKkZl.js.map → cli-prompt-DXG0yk-h.js.map} +1 -1
- package/dist/cli.js +121 -271
- package/dist/cli.js.map +1 -1
- package/dist/{collections-schema-version-T6cGvrDi.js → collections-schema-version-D7bDI0PJ.js} +13 -9
- package/dist/collections-schema-version-D7bDI0PJ.js.map +1 -0
- package/dist/{column-plan-helpers-D_V4oaZh.js → column-plan-helpers-IG6uFb1s.js} +2 -2
- package/dist/{column-plan-helpers-D_V4oaZh.js.map → column-plan-helpers-IG6uFb1s.js.map} +1 -1
- package/dist/{connection-C938nR3E.js → connection-czvI7TZL.js} +57 -10
- package/dist/connection-czvI7TZL.js.map +1 -0
- package/dist/{databasePoolManager-Yqdw14wY.js → databasePoolManager-3stMNFL-.js} +4 -6
- package/dist/databasePoolManager-3stMNFL-.js.map +1 -0
- package/dist/db-command-line.d.ts +14 -0
- package/dist/db-subcommands.d.ts +11 -0
- package/dist/{deferred-index-build-Cis_HoGn.js → deferred-index-build-CqaOv1Xx.js} +8 -8
- package/dist/{deferred-index-build-Cis_HoGn.js.map → deferred-index-build-CqaOv1Xx.js.map} +1 -1
- package/dist/{doctor-DvJH-IQG.js → doctor-DW_mlTzz.js} +186 -42
- package/dist/doctor-DW_mlTzz.js.map +1 -0
- package/dist/{ensure-collection-policies-CCqayoUz.js → ensure-collection-policies-DLWgabQ2.js} +13 -10
- package/dist/ensure-collection-policies-DLWgabQ2.js.map +1 -0
- package/dist/{ensure-collection-tables-DvvImXDe.js → ensure-collection-tables-CFIRq8ni.js} +9 -9
- package/dist/{ensure-collection-tables-DvvImXDe.js.map → ensure-collection-tables-CFIRq8ni.js.map} +1 -1
- package/dist/{ensure-tables-Dpgwx5sy.js → ensure-tables-4nA-tfwi.js} +5 -5
- package/dist/{ensure-tables-Dpgwx5sy.js.map → ensure-tables-4nA-tfwi.js.map} +1 -1
- package/dist/{enum-labels-kept-CUlUlRkO.js → enum-labels-kept-PcPW65xy.js} +3 -3
- package/dist/{enum-labels-kept-CUlUlRkO.js.map → enum-labels-kept-PcPW65xy.js.map} +1 -1
- package/dist/{generate-drizzle-schema-C3EAP9HE.js → generate-drizzle-schema-DC0BOUpn.js} +3 -3
- package/dist/{generate-drizzle-schema-C3EAP9HE.js.map → generate-drizzle-schema-DC0BOUpn.js.map} +1 -1
- package/dist/{generate-drizzle-schema-logic-DA3zM8zc.js → generate-drizzle-schema-logic-CPzCRD-8.js} +4 -4
- package/dist/{generate-drizzle-schema-logic-DA3zM8zc.js.map → generate-drizzle-schema-logic-CPzCRD-8.js.map} +1 -1
- package/dist/{generate-files-ClmOUHXj.js → generate-files-BP-4W_gm.js} +6 -6
- package/dist/{generate-files-ClmOUHXj.js.map → generate-files-BP-4W_gm.js.map} +1 -1
- package/dist/{generate-next-step-DCeS4LrJ.js → generate-next-step-DgK5BlBn.js} +2 -2
- package/dist/{generate-next-step-DCeS4LrJ.js.map → generate-next-step-DgK5BlBn.js.map} +1 -1
- package/dist/{generate-postgres-ddl-logic-4eUP4t8w.js → generate-postgres-ddl-logic-DPl1oH_z.js} +4 -4
- package/dist/{generate-postgres-ddl-logic-4eUP4t8w.js.map → generate-postgres-ddl-logic-DPl1oH_z.js.map} +1 -1
- package/dist/generated-schema-diff-eZCklRZQ.js +1025 -0
- package/dist/generated-schema-diff-eZCklRZQ.js.map +1 -0
- package/dist/{generated-schema-staleness-FlxM2i4i.js → generated-schema-staleness-BvNF3i-s.js} +2 -2
- package/dist/{generated-schema-staleness-FlxM2i4i.js.map → generated-schema-staleness-BvNF3i-s.js.map} +1 -1
- package/dist/history/HistoryService.d.ts +7 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.es.js +288 -11
- package/dist/index.es.js.map +1 -1
- package/dist/{introspect-db-logic-CI5CU_n0.js → introspect-db-logic-DgQVzccW.js} +2 -2
- package/dist/{introspect-db-logic-CI5CU_n0.js.map → introspect-db-logic-DgQVzccW.js.map} +1 -1
- package/dist/{rls-bootstrap-sql-Bd-hJk08.js → migrate-baseline-B-2Ef4Mv.js} +718 -41
- package/dist/migrate-baseline-B-2Ef4Mv.js.map +1 -0
- package/dist/migrate-policy-stamps-BQtFHApx.js +89 -0
- package/dist/migrate-policy-stamps-BQtFHApx.js.map +1 -0
- package/dist/{open-rebase-BKA7Nyoe.js → open-rebase-C8jQ6s5a.js} +324 -1047
- package/dist/open-rebase-C8jQ6s5a.js.map +1 -0
- package/dist/open-rebase.d.ts +9 -1
- package/dist/{pg-error-utils-Bv5n2PLn.js → pg-error-utils-DhiUTlVx.js} +2 -2
- package/dist/{pg-error-utils-Bv5n2PLn.js.map → pg-error-utils-DhiUTlVx.js.map} +1 -1
- package/dist/{plan-schema-CXOucCw-.js → plan-schema-Czf3q4-Q.js} +4 -4
- package/dist/{plan-schema-CXOucCw-.js.map → plan-schema-Czf3q4-Q.js.map} +1 -1
- package/dist/{policy-drift-vm0BcvcE.js → policy-drift-X4A-xAzv.js} +3 -3
- package/dist/{policy-drift-vm0BcvcE.js.map → policy-drift-X4A-xAzv.js.map} +1 -1
- package/dist/pool-disconnects.d.ts +28 -0
- package/dist/{push-index-prebuild-DIequ4bV.js → push-index-prebuild-UTvB5pqH.js} +4 -4
- package/dist/{push-index-prebuild-DIequ4bV.js.map → push-index-prebuild-UTvB5pqH.js.map} +1 -1
- package/dist/push-kept-defaults-BGOlOqRQ.js +137 -0
- package/dist/push-kept-defaults-BGOlOqRQ.js.map +1 -0
- package/dist/{push-legacy-renames-BqJut4F3.js → push-legacy-renames-BwaKi8xF.js} +4 -4
- package/dist/{push-legacy-renames-BqJut4F3.js.map → push-legacy-renames-BwaKi8xF.js.map} +1 -1
- package/dist/{push-policy-plan-CvX8hiPb.js → push-policy-plan-DQ2tWceD.js} +5 -5
- package/dist/{push-policy-plan-CvX8hiPb.js.map → push-policy-plan-DQ2tWceD.js.map} +1 -1
- package/dist/{render-ddl-CQNwZdse.js → render-ddl-4v88y-Gv.js} +4 -4
- package/dist/{render-ddl-CQNwZdse.js.map → render-ddl-4v88y-Gv.js.map} +1 -1
- package/dist/{rls-enforcement-D7P4-ZYX.js → rls-enforcement-BOHuHVlc.js} +43 -4
- package/dist/rls-enforcement-BOHuHVlc.js.map +1 -0
- package/dist/schema/destructive-sql.d.ts +16 -0
- package/dist/schema/doctor-cli.js +5 -5
- package/dist/schema/doctor.d.ts +20 -2
- package/dist/schema/ensure-collection-policies.d.ts +4 -1
- package/dist/schema/generate-drizzle-schema.js +1 -1
- package/dist/schema/generate-postgres-ddl.js +2 -2
- package/dist/schema/generated-schema-diff.d.ts +21 -0
- package/dist/schema/introspect-db.js +5 -6
- package/dist/schema/introspect-db.js.map +1 -1
- package/dist/schema/migrate-policy-stamps.d.ts +23 -0
- package/dist/schema/migration-freshness.d.ts +69 -0
- package/dist/schema/push-kept-defaults.d.ts +57 -0
- package/dist/schema/push-policy-plan.d.ts +5 -0
- package/dist/schema/rls-bootstrap-sql.d.ts +47 -10
- package/dist/security/rls-enforcement.d.ts +18 -0
- package/dist/services/BranchService.d.ts +20 -2
- package/dist/services/FetchService.d.ts +12 -0
- package/dist/services/channel-presence.d.ts +3 -1
- package/dist/services/nested-path.d.ts +16 -0
- package/dist/services/pg-notify-listener.d.ts +2 -0
- package/dist/services/realtimeService.d.ts +18 -1
- package/dist/{source-Bv5KPeIx.js → source-fZb92pN8.js} +2 -2
- package/dist/{source-Bv5KPeIx.js.map → source-fZb92pN8.js.map} +1 -1
- package/dist/{vector-index-BFhyEaiz.js → vector-index-DsQ3V2d2.js} +2 -2
- package/dist/{vector-index-BFhyEaiz.js.map → vector-index-DsQ3V2d2.js.map} +1 -1
- package/dist/{websocket-MC0zTBar.js → websocket-CKYc3V4N.js} +56 -14
- package/dist/websocket-CKYc3V4N.js.map +1 -0
- package/package.json +7 -7
- package/dist/BranchService-iXXZeVYD.js.map +0 -1
- package/dist/backup-cli-B2CAn9fR.js +0 -647
- package/dist/backup-cli-B2CAn9fR.js.map +0 -1
- package/dist/backup-service-Bb39plam.js.map +0 -1
- package/dist/cli-console-DQ_K-sdM.js.map +0 -1
- package/dist/cli-errors-DwQnNATs.js.map +0 -1
- package/dist/cli-flags-D-b0qL9T.js +0 -206
- package/dist/cli-flags-D-b0qL9T.js.map +0 -1
- package/dist/collections-schema-version-T6cGvrDi.js.map +0 -1
- package/dist/connection-C938nR3E.js.map +0 -1
- package/dist/databasePoolManager-Yqdw14wY.js.map +0 -1
- package/dist/doctor-DvJH-IQG.js.map +0 -1
- package/dist/ensure-collection-policies-CCqayoUz.js.map +0 -1
- package/dist/open-rebase-BKA7Nyoe.js.map +0 -1
- package/dist/rls-bootstrap-sql-Bd-hJk08.js.map +0 -1
- package/dist/rls-enforcement-D7P4-ZYX.js.map +0 -1
- package/dist/rolldown-runtime-V7rFbMRe.js +0 -39
- package/dist/websocket-MC0zTBar.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
__createRequire(import.meta.url);
|
|
3
|
-
import { a as outWarn, i as outError, m as isRebaseIndexName, o as atlasExcludePattern, r as out, s as excludePatternParts, t as chalk } from "./source-
|
|
3
|
+
import { a as outWarn, i as outError, m as isRebaseIndexName, o as atlasExcludePattern, r as out, s as excludePatternParts, t as chalk } from "./source-fZb92pN8.js";
|
|
4
|
+
import { warnDeprecated } from "@rebasepro/common";
|
|
4
5
|
import path from "path";
|
|
5
6
|
import fs from "fs";
|
|
6
7
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
@@ -184,6 +185,37 @@ function redactConnectionPasswords(text) {
|
|
|
184
185
|
//#endregion
|
|
185
186
|
//#region src/schema/destructive-sql.ts
|
|
186
187
|
/**
|
|
188
|
+
* Pure helpers that classify an Atlas declarative-apply plan as destructive
|
|
189
|
+
* or not, and decide what `rebase db push` should do about it.
|
|
190
|
+
*
|
|
191
|
+
* `db push` runs `atlas schema apply` to make the live database match the
|
|
192
|
+
* generated `schema.sql`. Removing a collection field compiles to
|
|
193
|
+
* `DROP COLUMN`; renaming compiles to drop-then-add — either destroys data.
|
|
194
|
+
* We first run the apply with `--dry-run` to obtain the planned SQL, scan it
|
|
195
|
+
* here, and refuse to auto-approve anything destructive without an explicit
|
|
196
|
+
* opt-in.
|
|
197
|
+
*
|
|
198
|
+
* A type change is a destructive plan that names no DROP. `ALTER COLUMN
|
|
199
|
+
* "price" TYPE integer` rounds every 19.99 to 20, and `TYPE date` throws away
|
|
200
|
+
* every timestamp's time of day, in a statement that reads like a routine
|
|
201
|
+
* alter. So a type change is gated too, unless it is a widening every value
|
|
202
|
+
* survives unchanged — which needs the column's current type, read from the
|
|
203
|
+
* catalogue by the caller.
|
|
204
|
+
*
|
|
205
|
+
* A primary key change names no DROP of data either: `DROP CONSTRAINT
|
|
206
|
+
* "<table>_pkey", ADD PRIMARY KEY ("id", "locale")` keeps every value and
|
|
207
|
+
* gives every row a new address. It is gated like a drop.
|
|
208
|
+
*
|
|
209
|
+
* So is the drop of a CHECK or EXCLUDE constraint. It keeps every row and
|
|
210
|
+
* stops refusing the ones the rule was there to refuse. `db push` keeps Atlas
|
|
211
|
+
* away from those constraints (`schema/undeclarable-constraints.ts`), so a plan
|
|
212
|
+
* that still drops one is a pattern that missed, and the gate is the second
|
|
213
|
+
* line. Which constraints those are is read from the catalogue by the caller.
|
|
214
|
+
*
|
|
215
|
+
* Everything in this file is side-effect free so it can be unit-tested
|
|
216
|
+
* without Atlas or a database.
|
|
217
|
+
*/
|
|
218
|
+
/**
|
|
187
219
|
* SQL fragments that destroy data or data-bearing objects. Matched
|
|
188
220
|
* case-insensitively against each statement of the plan. `IF EXISTS` /
|
|
189
221
|
* whitespace variations are tolerated by the regexes below.
|
|
@@ -643,6 +675,25 @@ function destructiveOptInFlag(args) {
|
|
|
643
675
|
if (args["--yes"] === true) return "--yes";
|
|
644
676
|
}
|
|
645
677
|
/**
|
|
678
|
+
* What a destructive push approved by `--yes` says, once per process.
|
|
679
|
+
*
|
|
680
|
+
* `--yes` is an alias of `--allow-destructive` on `db push`, and nothing else
|
|
681
|
+
* spells it that way: on `rebase init` it means "take the defaults", and an
|
|
682
|
+
* agent passes it by reflex to get past prompts — so one habitual flag
|
|
683
|
+
* dropped a column ("Proceeding because --yes was passed" → DROP COLUMN). It
|
|
684
|
+
* keeps working for one release, as the deprecate-before-removing rule asks,
|
|
685
|
+
* and says what changes next.
|
|
686
|
+
*/
|
|
687
|
+
var YES_APPROVES_DESTRUCTIVE_DEPRECATION = "`rebase db push --yes` approved a change that destroys data. Next release, --yes will only approve non-destructive pushes; pass --allow-destructive to apply destructive changes.";
|
|
688
|
+
/**
|
|
689
|
+
* Warn — once per process, through `warnDeprecated` — when it was `--yes`, not
|
|
690
|
+
* `--allow-destructive`, that let destructive statements through.
|
|
691
|
+
*/
|
|
692
|
+
function warnIfYesApprovedDestructive(optIn, destructiveCount) {
|
|
693
|
+
if (optIn !== "--yes" || destructiveCount === 0) return;
|
|
694
|
+
warnDeprecated("db push --yes approves destructive changes", YES_APPROVES_DESTRUCTIVE_DEPRECATION);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
646
697
|
* Decide how `db push` should proceed given the plan's destructiveness and
|
|
647
698
|
* the invocation context.
|
|
648
699
|
*
|
|
@@ -1292,7 +1343,7 @@ async function applySearchDdl(databaseUrl, sqlDir = generatedSqlDir()) {
|
|
|
1292
1343
|
* `search` block, which is every project that has not opted in.
|
|
1293
1344
|
*/
|
|
1294
1345
|
async function getSearchExcludes(collectionsPath) {
|
|
1295
|
-
const { searchExcludePatterns } = await import("./generate-postgres-ddl-logic-
|
|
1346
|
+
const { searchExcludePatterns } = await import("./generate-postgres-ddl-logic-DPl1oH_z.js").then((n) => n.o);
|
|
1296
1347
|
return searchExcludePatterns(await loadCollectionsForCli(collectionsPath));
|
|
1297
1348
|
}
|
|
1298
1349
|
/**
|
|
@@ -1379,7 +1430,7 @@ function readVectorDdl(sqlDir = generatedSqlDir()) {
|
|
|
1379
1430
|
async function applyVectorDdl(databaseUrl, sqlDir = generatedSqlDir()) {
|
|
1380
1431
|
const sql = readVectorDdl(sqlDir);
|
|
1381
1432
|
if (!sql) return;
|
|
1382
|
-
const { vectorExtensionHint } = await import("./vector-index-
|
|
1433
|
+
const { vectorExtensionHint } = await import("./vector-index-DsQ3V2d2.js").then((n) => n.f);
|
|
1383
1434
|
try {
|
|
1384
1435
|
await withAppClient(databaseUrl, (client) => client.query(sql));
|
|
1385
1436
|
} catch (err) {
|
|
@@ -1397,7 +1448,7 @@ async function applyVectorDdl(databaseUrl, sqlDir = generatedSqlDir()) {
|
|
|
1397
1448
|
* `vector` property, which is every project that has not opted in.
|
|
1398
1449
|
*/
|
|
1399
1450
|
async function getVectorExcludes(collectionsPath) {
|
|
1400
|
-
const { vectorExcludePatterns } = await import("./generate-postgres-ddl-logic-
|
|
1451
|
+
const { vectorExcludePatterns } = await import("./generate-postgres-ddl-logic-DPl1oH_z.js").then((n) => n.o);
|
|
1401
1452
|
return vectorExcludePatterns(await loadCollectionsForCli(collectionsPath));
|
|
1402
1453
|
}
|
|
1403
1454
|
/**
|
|
@@ -1434,7 +1485,7 @@ async function applyTriggersDdl(databaseUrl, sqlDir = generatedSqlDir()) {
|
|
|
1434
1485
|
}
|
|
1435
1486
|
/** @see getSearchExcludes */
|
|
1436
1487
|
async function getTriggerExcludes(collectionsPath) {
|
|
1437
|
-
const { triggerExcludePatterns } = await import("./generate-postgres-ddl-logic-
|
|
1488
|
+
const { triggerExcludePatterns } = await import("./generate-postgres-ddl-logic-DPl1oH_z.js").then((n) => n.o);
|
|
1438
1489
|
return triggerExcludePatterns(await loadCollectionsForCli(collectionsPath));
|
|
1439
1490
|
}
|
|
1440
1491
|
/**
|
|
@@ -1511,9 +1562,9 @@ async function getForeignIndexExcludes(databaseUrl, collectionsPath, deps = {})
|
|
|
1511
1562
|
*/
|
|
1512
1563
|
async function managedIndexNames(collectionsPath) {
|
|
1513
1564
|
const collections = await loadCollectionsForCli(collectionsPath);
|
|
1514
|
-
const { searchExcludePatterns, vectorExcludePatterns } = await import("./generate-postgres-ddl-logic-
|
|
1515
|
-
const { resolveColumnName } = await import("./column-plan-helpers-
|
|
1516
|
-
const { buildCollectionIndexPlan } = await import("./source-
|
|
1565
|
+
const { searchExcludePatterns, vectorExcludePatterns } = await import("./generate-postgres-ddl-logic-DPl1oH_z.js").then((n) => n.o);
|
|
1566
|
+
const { resolveColumnName } = await import("./column-plan-helpers-IG6uFb1s.js").then((n) => n.t);
|
|
1567
|
+
const { buildCollectionIndexPlan } = await import("./source-fZb92pN8.js").then((n) => n.d);
|
|
1517
1568
|
const names = new Set(buildCollectionIndexPlan(collections, resolveColumnName).map((spec) => spec.indexName));
|
|
1518
1569
|
for (const pattern of [...searchExcludePatterns(collections), ...vectorExcludePatterns(collections)]) {
|
|
1519
1570
|
const object = excludePatternParts(pattern)?.[2];
|
|
@@ -2051,6 +2102,34 @@ function projectRebaseCommand(manager) {
|
|
|
2051
2102
|
default: return "rebase";
|
|
2052
2103
|
}
|
|
2053
2104
|
}
|
|
2105
|
+
/** A PostgreSQL identifier, double-quoted, with any `"` in it doubled. */
|
|
2106
|
+
function sqlIdentifier(name) {
|
|
2107
|
+
return `"${name.replace(/"/g, "\"\"")}"`;
|
|
2108
|
+
}
|
|
2109
|
+
/**
|
|
2110
|
+
* `text` as one double-quoted `sh` word: `\`, `"`, `$` and a backtick are the
|
|
2111
|
+
* characters a double-quoted string does not take literally.
|
|
2112
|
+
*/
|
|
2113
|
+
function shDoubleQuoted(text) {
|
|
2114
|
+
return `"${text.replace(/[\\"$`]/g, "\\$&")}"`;
|
|
2115
|
+
}
|
|
2116
|
+
/**
|
|
2117
|
+
* The backfill for a column that refused NOT NULL, as one line a POSIX shell
|
|
2118
|
+
* runs once the value is typed between its single quotes.
|
|
2119
|
+
*
|
|
2120
|
+
* The SQL is the shell's double-quoted word, so the value's own quotes are
|
|
2121
|
+
* SQL's: `'tbd'`, or `'O''Brien'` for a value with a quote in it, as SQL
|
|
2122
|
+
* writes one. It was the SQL in shell single quotes, and the first quote a
|
|
2123
|
+
* value was typed with ended the shell's: `= 'tbd'` reached psql as `= tbd`,
|
|
2124
|
+
* `column "tbd" does not exist`.
|
|
2125
|
+
*
|
|
2126
|
+
* `rebase db url`, not `$DATABASE_URL`: on the managed development database
|
|
2127
|
+
* `.env` leaves DATABASE_URL unset, and the shell has none.
|
|
2128
|
+
*/
|
|
2129
|
+
function backfillCommand(table, column, manager) {
|
|
2130
|
+
const sql = `UPDATE ${sqlIdentifier(table)} SET ${sqlIdentifier(column)} = '…' WHERE ${sqlIdentifier(column)} IS NULL;`;
|
|
2131
|
+
return `psql "$(${projectRebaseCommand(manager)} db url)" -c ${shDoubleQuoted(sql)}`;
|
|
2132
|
+
}
|
|
2054
2133
|
/**
|
|
2055
2134
|
* The ways out, and only the ones that work for this column.
|
|
2056
2135
|
*
|
|
@@ -2067,7 +2146,7 @@ function projectRebaseCommand(manager) {
|
|
|
2067
2146
|
function formatNotNullViolationBanner(violation, rowCount, isNew = null, manager = detectProjectPackageManager()) {
|
|
2068
2147
|
const { table, column } = violation;
|
|
2069
2148
|
const rows = rowCount === null ? ` "${table}" already holds rows, and none of them has a value for "${column}".\n` : ` "${table}" already holds ${rowCount} row${rowCount === 1 ? "" : "s"}, and they have no value for "${column}".\n`;
|
|
2070
|
-
const backfill = `Backfill by hand first, then push again:\n ${chalk.gray(
|
|
2149
|
+
const backfill = `Backfill by hand first, then push again, with the value between the single quotes:\n ${chalk.gray(backfillCommand(table, column, manager))}\n`;
|
|
2071
2150
|
const leaveOptional = `Leave it optional — take \`validation.required\` off the property.\n`;
|
|
2072
2151
|
const defaultLine = (caveat) => `Give the property a default, so the push can backfill${caveat}:\n ${chalk.gray(`{ type: "string", defaultValue: "…", validation: { required: true } }`)}\n`;
|
|
2073
2152
|
const remedies = isNew === false ? [backfill, leaveOptional] : isNew === true ? [
|
|
@@ -2356,6 +2435,6 @@ async function diagnoseAtlasFailure(context) {
|
|
|
2356
2435
|
return null;
|
|
2357
2436
|
}
|
|
2358
2437
|
//#endregion
|
|
2359
|
-
export {
|
|
2438
|
+
export { forAtlas as $, getUndeclaredConstraintExcludes as A, withAppClient as B, dropDevDatabase as C, getSearchExcludes as D, getForeignIndexExcludes as E, queryUndeclarableConstraints as F, prepareGeneratedSqlDir as G, DESIRED_STATE_URL as H, readSearchDdl as I, detectDestructiveStatements as J, decidePushSafety as K, readTriggersDdl as L, loadCollectionsForCli as M, queryColumnTypes as N, getTableExcludes as O, queryGeneratedColumnDependencies as P, warnIfYesApprovedDestructive as Q, readVectorDdl as R, diagnoseMissingBin as S, ensureDevDatabaseExists as T, GENERATED_SQL_DIR as U, workspaceMemberDir as V, generatedSqlDir as W, fromAlterTable as X, extractPlanStatements as Y, isSyncedPlan as Z, closeAppClients as _, diagnoseDbError as a, describeReinstallCommand as b, isEconnrefused as c, reportCommandFailure as d, forLibpq as et, ExcludeIntrospectionError as f, atlasDevDatabaseUrl as g, applyVectorDdl as h, diagnoseAtlasFailure as i, getVectorExcludes as j, getTriggerExcludes as k, isSslNotEnabled as l, applyTriggersDdl as m, closedDatabaseName as n, splitPassword as nt, formatForeignGeneratedColumnBanner as o, applySearchDdl as p, destructiveOptInFlag as q, deepestErrorMessage as r, extractCauseMessage as rt, isAuthFailure as s, checkDatabaseConnectivity as t, redactConnectionPasswords as tt, parseHostInfo as u, describeBuildScriptRemedy as v, dropGeneratedColumns as w, detectProjectPackageManager as x, describeDevAddCommand as y, resolveLocalBin as z };
|
|
2360
2439
|
|
|
2361
|
-
//# sourceMappingURL=cli-errors-
|
|
2440
|
+
//# sourceMappingURL=cli-errors-DsYyNYzd.js.map
|