@rebasepro/server-postgres 0.33.2 → 0.34.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-Bdin0Wxh.js → BranchService-BLcVK_Rd.js} +3 -3
- package/dist/{BranchService-Bdin0Wxh.js.map → BranchService-BLcVK_Rd.js.map} +1 -1
- package/dist/{backup-cli-BEAMPWMs.js → backup-cli-CVLOCTo_.js} +3 -3
- package/dist/{backup-cli-BEAMPWMs.js.map → backup-cli-CVLOCTo_.js.map} +1 -1
- package/dist/{boot-ddl-Bu6gAY-2.js → boot-ddl-C7hAFEvY.js} +2 -2
- package/dist/{boot-ddl-Bu6gAY-2.js.map → boot-ddl-C7hAFEvY.js.map} +1 -1
- package/dist/{cli-console-BU_Rf22O.js → cli-console-E5TM3GaL.js} +4 -4
- package/dist/{cli-console-BU_Rf22O.js.map → cli-console-E5TM3GaL.js.map} +1 -1
- package/dist/{cli-schema-dir-CjDH_31U.js → cli-schema-dir-CdEqBcph.js} +29 -10
- package/dist/cli-schema-dir-CdEqBcph.js.map +1 -0
- package/dist/cli.js +29 -27
- package/dist/cli.js.map +1 -1
- package/dist/{database-preflight-DKzsGnc4.js → database-preflight-NmFI_rFN.js} +2 -2
- package/dist/{database-preflight-DKzsGnc4.js.map → database-preflight-NmFI_rFN.js.map} +1 -1
- package/dist/{deferred-index-build-88bWtYgx.js → deferred-index-build-Bz37bvxW.js} +4 -4
- package/dist/{deferred-index-build-88bWtYgx.js.map → deferred-index-build-Bz37bvxW.js.map} +1 -1
- package/dist/{ensure-policies-nIITKxud.js → ensure-policies-C1UCom37.js} +6 -6
- package/dist/{ensure-policies-nIITKxud.js.map → ensure-policies-C1UCom37.js.map} +1 -1
- package/dist/{ensure-tables-hQ5oAK_j.js → ensure-tables-BVUNi6uG.js} +3 -3
- package/dist/{ensure-tables-hQ5oAK_j.js.map → ensure-tables-BVUNi6uG.js.map} +1 -1
- package/dist/{ensure-tables-Lm-77eM5.js → ensure-tables-DjuNRClr.js} +7 -7
- package/dist/{ensure-tables-Lm-77eM5.js.map → ensure-tables-DjuNRClr.js.map} +1 -1
- package/dist/{enum-labels-kept-mesgEJWH.js → enum-labels-kept-DrCueSHr.js} +2 -2
- package/dist/{enum-labels-kept-mesgEJWH.js.map → enum-labels-kept-DrCueSHr.js.map} +1 -1
- package/dist/{generated-schema-diff-DoT2dYDe.js → generated-schema-diff-DDktAATD.js} +2 -2
- package/dist/{generated-schema-diff-DoT2dYDe.js.map → generated-schema-diff-DDktAATD.js.map} +1 -1
- package/dist/index.es.js +11 -11
- package/dist/{introspect-db-queries-BgiRQqtR.js → introspect-db-queries-D7u9EOfV.js} +66 -4
- package/dist/introspect-db-queries-D7u9EOfV.js.map +1 -0
- package/dist/{introspect-tables-Cw_A-kk4.js → introspect-tables-2yJ3p98l.js} +267 -30
- package/dist/introspect-tables-2yJ3p98l.js.map +1 -0
- package/dist/{migrate-baseline-Bzj5gSCM.js → migrate-baseline-CnIbBRgh.js} +4 -3
- package/dist/{migrate-baseline-Bzj5gSCM.js.map → migrate-baseline-CnIbBRgh.js.map} +1 -1
- package/dist/{migrate-policy-stamps-C2WaOEsB.js → migrate-policy-stamps-D7BaYeKO.js} +4 -4
- package/dist/{migrate-policy-stamps-C2WaOEsB.js.map → migrate-policy-stamps-D7BaYeKO.js.map} +1 -1
- package/dist/{open-rebase-x3yAPy5g.js → open-rebase-DykxNl1j.js} +72 -20
- package/dist/open-rebase-DykxNl1j.js.map +1 -0
- package/dist/{pg-error-utils-CWopxboq.js → pg-error-utils-DXyqf9yP.js} +2 -2
- package/dist/{pg-error-utils-CWopxboq.js.map → pg-error-utils-DXyqf9yP.js.map} +1 -1
- package/dist/{policy-drift-rVLKS2AG.js → policy-drift-B2Czzs2Z.js} +3 -3
- package/dist/{policy-drift-rVLKS2AG.js.map → policy-drift-B2Czzs2Z.js.map} +1 -1
- package/dist/{push-index-adoption-EcamXfW2.js → push-index-adoption-DTLPk_5i.js} +2 -2
- package/dist/{push-index-adoption-EcamXfW2.js.map → push-index-adoption-DTLPk_5i.js.map} +1 -1
- package/dist/{push-index-prebuild-BPIns6wA.js → push-index-prebuild-WP5272gZ.js} +3 -3
- package/dist/{push-index-prebuild-BPIns6wA.js.map → push-index-prebuild-WP5272gZ.js.map} +1 -1
- package/dist/{push-legacy-renames-lmYkb41I.js → push-legacy-renames-CvWSBxRu.js} +3 -3
- package/dist/{push-legacy-renames-lmYkb41I.js.map → push-legacy-renames-CvWSBxRu.js.map} +1 -1
- package/dist/{push-policy-plan-Dqu4FKWh.js → push-policy-plan-D8HvHgPs.js} +3 -3
- package/dist/{push-policy-plan-Dqu4FKWh.js.map → push-policy-plan-D8HvHgPs.js.map} +1 -1
- package/dist/{request-role-cli-Ay0v9oYZ.js → request-role-cli-Y5Uqalop.js} +8 -8
- package/dist/{request-role-cli-Ay0v9oYZ.js.map → request-role-cli-Y5Uqalop.js.map} +1 -1
- package/dist/{request-role-migration-DTE3Owsh.js → request-role-migration-Cc0gJSso.js} +2 -2
- package/dist/{request-role-migration-DTE3Owsh.js.map → request-role-migration-Cc0gJSso.js.map} +1 -1
- package/dist/{rls-enforcement-Ck-d8zdJ.js → rls-enforcement-NZKe3Jr-.js} +2 -2
- package/dist/{rls-enforcement-Ck-d8zdJ.js.map → rls-enforcement-NZKe3Jr-.js.map} +1 -1
- package/dist/schema/destructive-sql.d.ts +9 -1
- package/dist/schema/doctor-cli.js +6 -6
- package/dist/schema/introspect-db-logic.d.ts +51 -0
- package/dist/schema/introspect-db-project.d.ts +6 -0
- package/dist/schema/introspect-db-queries.d.ts +21 -2
- package/dist/schema/introspect-db.js +53 -4
- package/dist/schema/introspect-db.js.map +1 -1
- package/dist/schema/introspect-foreign.d.ts +47 -0
- package/dist/schema/introspect-tables.d.ts +17 -0
- package/dist/schema/undeclarable-constraints.d.ts +16 -3
- package/dist/utils/result-rows.d.ts +20 -0
- package/dist/{websocket-DAVDn7Ki.js → websocket-CvmbzBeS.js} +3 -3
- package/dist/{websocket-DAVDn7Ki.js.map → websocket-CvmbzBeS.js.map} +1 -1
- package/package.json +7 -7
- package/dist/cli-schema-dir-CjDH_31U.js.map +0 -1
- package/dist/introspect-db-queries-BgiRQqtR.js.map +0 -1
- package/dist/introspect-tables-Cw_A-kk4.js.map +0 -1
- package/dist/open-rebase-x3yAPy5g.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
__createRequire(import.meta.url);
|
|
3
3
|
import { n as require_arg, o as __toESM, t as promptConfirm } from "./cli-prompt-DXG0yk-h.js";
|
|
4
|
-
import { $ as decidePushSafety, A as dropDevDatabase, B as queryGeneratedColumnDependencies, C as closeAppClients, D as describeReinstallCommand, E as describeDevAddCommand, F as getTableExcludes, G as readViewsDdl, H as readSearchDdl, I as getTriggerExcludes, J as workspaceMemberDir, K as resolveLocalBin, L as getUndeclaredConstraintExcludes, M as ensureDevDatabaseExists, N as getForeignIndexExcludes, O as detectProjectPackageManager, P as getSearchExcludes, Q as prepareGeneratedSqlDir, R as getVectorExcludes, T as describeBuildScriptRemedy, U as readTriggersDdl, V as queryUndeclarableConstraints, W as readVectorDdl, X as GENERATED_SQL_DIR, Y as DESIRED_STATE_URL, Z as generatedSqlDir, _ as applySearchDdl, at as
|
|
4
|
+
import { $ as decidePushSafety, A as dropDevDatabase, B as queryGeneratedColumnDependencies, C as closeAppClients, D as describeReinstallCommand, E as describeDevAddCommand, F as getTableExcludes, G as readViewsDdl, H as readSearchDdl, I as getTriggerExcludes, J as workspaceMemberDir, K as resolveLocalBin, L as getUndeclaredConstraintExcludes, M as ensureDevDatabaseExists, N as getForeignIndexExcludes, O as detectProjectPackageManager, P as getSearchExcludes, Q as prepareGeneratedSqlDir, R as getVectorExcludes, T as describeBuildScriptRemedy, U as readTriggersDdl, V as queryUndeclarableConstraints, W as readVectorDdl, X as GENERATED_SQL_DIR, Y as DESIRED_STATE_URL, Z as generatedSqlDir, _ as applySearchDdl, at as isSyncedPlan, b as applyViewsDdl, c as diagnoseDbError, d as isEconnrefused, et as describeDestructiveFindings, f as isSslNotEnabled, g as ExcludeIntrospectionError, h as reportCommandFailure, i as checkDatabaseConnectivity, it as fromAlterTable, j as dropGeneratedColumns, k as diagnoseMissingBin, l as formatForeignGeneratedColumnBanner, lt as redactConnectionPasswords, n as assertNoCollectionsFlag, nt as detectDestructiveStatements, ot as warnIfYesApprovedDestructive, q as withAppClient, r as assertSchemaDirExists, rt as extractPlanStatements, s as diagnoseAtlasFailure, st as forAtlas, tt as destructiveOptInFlag, u as isAuthFailure, v as applyTriggersDdl, w as describeAtlasWindowsInstall, x as atlasDevDatabaseUrl, y as applyVectorDdl, z as queryColumnTypes } from "./cli-schema-dir-CdEqBcph.js";
|
|
5
5
|
import { i as RLS_BOOTSTRAP_SQL, o as dropLegacyAuthSchema, r as REQUEST_ROLE_FUNCTION_SQL, t as ADMIN_POLICY_ROLE_SQL } from "./rls-bootstrap-sql-kPX4-MB1.js";
|
|
6
6
|
import { a as outWarn, i as outError, o as atlasExcludePattern, r as out, s as excludePatternParts, t as chalk } from "./source-VxbrQojV.js";
|
|
7
|
-
import { C as declaredIndexesIfNotExists, S as execa, b as resolveDriverSwitches, c as isDriverDbSubcommand, d as branchNameIn, f as branchSourceIn, g as assertKnownFlags, i as latestRecordedMigration, l as backupActionOf, m as unexpectedBranchArgs, o as planBaseline, p as resolveBranchSwitches, r as describeBaselinePlan, s as DRIVER_DB_SUBCOMMANDS, t as baselineVersionProblem, w as indexAdoptionStatement, x as schemaDirIn, y as parseDriverLine } from "./migrate-baseline-
|
|
7
|
+
import { C as declaredIndexesIfNotExists, S as execa, b as resolveDriverSwitches, c as isDriverDbSubcommand, d as branchNameIn, f as branchSourceIn, g as assertKnownFlags, i as latestRecordedMigration, l as backupActionOf, m as unexpectedBranchArgs, o as planBaseline, p as resolveBranchSwitches, r as describeBaselinePlan, s as DRIVER_DB_SUBCOMMANDS, t as baselineVersionProblem, w as indexAdoptionStatement, x as schemaDirIn, y as parseDriverLine } from "./migrate-baseline-CnIbBRgh.js";
|
|
8
8
|
import { t as nextStepAfterDbGenerate } from "./generate-next-step-CO09dovd.js";
|
|
9
9
|
import { REBASE_ADMIN_ROLE, declaredRlsPolicyShape } from "@rebasepro/types";
|
|
10
10
|
import { formatRelativeTime } from "@rebasepro/utils";
|
|
@@ -1189,7 +1189,7 @@ async function runPluginCommand(args) {
|
|
|
1189
1189
|
else if (domain === "schema") await schemaCommand(subcommand, args);
|
|
1190
1190
|
else if (domain === "doctor") await doctorPluginCommand(args);
|
|
1191
1191
|
else if (domain === "console") {
|
|
1192
|
-
const { consoleCommand } = await import("./cli-console-
|
|
1192
|
+
const { consoleCommand } = await import("./cli-console-E5TM3GaL.js");
|
|
1193
1193
|
process.exitCode = await consoleCommand(args);
|
|
1194
1194
|
} else {
|
|
1195
1195
|
outError(chalk.red(`Unknown domain command: ${domain}`));
|
|
@@ -1335,7 +1335,7 @@ async function reportDestructiveMigration(migrationSql, migrationFile, databaseU
|
|
|
1335
1335
|
const destructive = detectDestructiveStatements(migrationSql, await columnTypesOrNone(databaseUrl), await constraintsOrNone(databaseUrl));
|
|
1336
1336
|
if (destructive.length === 0) return;
|
|
1337
1337
|
outWarn("");
|
|
1338
|
-
outWarn(chalk.yellow(` ⚠️ ${migrationFile} includes ${destructive.length}
|
|
1338
|
+
outWarn(chalk.yellow(` ⚠️ ${migrationFile} includes ${destructive.length} change(s) that need confirming: ${describeDestructiveFindings(destructive)}.`));
|
|
1339
1339
|
outWarn("");
|
|
1340
1340
|
for (const line of destructiveLines(destructive)) outWarn(line);
|
|
1341
1341
|
outWarn("");
|
|
@@ -1374,17 +1374,17 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1374
1374
|
return;
|
|
1375
1375
|
}
|
|
1376
1376
|
if (subcommand === "request-role") {
|
|
1377
|
-
const { requestRoleCommand } = await import("./request-role-cli-
|
|
1377
|
+
const { requestRoleCommand } = await import("./request-role-cli-Y5Uqalop.js").then((n) => n.r);
|
|
1378
1378
|
await requestRoleCommand(rawArgs);
|
|
1379
1379
|
return;
|
|
1380
1380
|
}
|
|
1381
1381
|
if (subcommand === "provision") {
|
|
1382
|
-
const { provisionCommand } = await import("./request-role-cli-
|
|
1382
|
+
const { provisionCommand } = await import("./request-role-cli-Y5Uqalop.js").then((n) => n.r);
|
|
1383
1383
|
await provisionCommand(rawArgs);
|
|
1384
1384
|
return;
|
|
1385
1385
|
}
|
|
1386
1386
|
if (subcommand === "backup" || subcommand === "restore" || subcommand === "backups") {
|
|
1387
|
-
const { backupCommand, restoreCommand, backupsCommand } = await import("./backup-cli-
|
|
1387
|
+
const { backupCommand, restoreCommand, backupsCommand } = await import("./backup-cli-CVLOCTo_.js").then((n) => n.t);
|
|
1388
1388
|
if (subcommand === "backup" && backupActionOf(rawArgs) === "list") await backupsCommand(rawArgs);
|
|
1389
1389
|
else if (subcommand === "backup") await backupCommand(rawArgs);
|
|
1390
1390
|
else if (subcommand === "restore") await restoreCommand(rawArgs);
|
|
@@ -1574,7 +1574,7 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
if (unowned.length > 0) outWarn(formatForeignGeneratedColumnBanner(unowned));
|
|
1576
1576
|
if (destructive.length > 0) {
|
|
1577
|
-
outWarn(chalk.yellow(` ⚠️ ${destructive.length} of those
|
|
1577
|
+
outWarn(chalk.yellow(` ⚠️ ${destructive.length} of those need confirming: ${describeDestructiveFindings(destructive)}.`));
|
|
1578
1578
|
for (const line of destructiveLines(destructive)) outWarn(line);
|
|
1579
1579
|
outWarn("");
|
|
1580
1580
|
outWarn(chalk.yellow(" Applying them needs `rebase db push --allow-destructive`. Back up first: rebase db backup"));
|
|
@@ -1596,7 +1596,7 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1596
1596
|
interactive: process.stdin.isTTY === true
|
|
1597
1597
|
});
|
|
1598
1598
|
if (destructive.length > 0) {
|
|
1599
|
-
outWarn(chalk.yellow(` ⚠️ This push includes ${destructive.length}
|
|
1599
|
+
outWarn(chalk.yellow(` ⚠️ This push includes ${destructive.length} change(s) that need confirming: ${describeDestructiveFindings(destructive)}.`));
|
|
1600
1600
|
outWarn("");
|
|
1601
1601
|
for (const line of destructiveLines(destructive)) outWarn(line);
|
|
1602
1602
|
outWarn("");
|
|
@@ -1715,7 +1715,7 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1715
1715
|
const adminRoleAvailable = await readAdminPoliciesLive(databaseUrl);
|
|
1716
1716
|
if (!adminRoleAvailable) await moveAdminPoliciesToPublic(databaseUrl, schemaDir);
|
|
1717
1717
|
await dropStaleCompanions(databaseUrl, schemaDir, adminRoleAvailable);
|
|
1718
|
-
const { stampMigratedPolicies } = await import("./migrate-policy-stamps-
|
|
1718
|
+
const { stampMigratedPolicies } = await import("./migrate-policy-stamps-D7BaYeKO.js");
|
|
1719
1719
|
await stampMigratedPolicies(databaseUrl, schemaDir, adminRoleAvailable);
|
|
1720
1720
|
}
|
|
1721
1721
|
}
|
|
@@ -1770,7 +1770,7 @@ async function renameLegacyForeignKeys(databaseUrl, schemaDir, dryRun) {
|
|
|
1770
1770
|
let renames;
|
|
1771
1771
|
try {
|
|
1772
1772
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
1773
|
-
const { legacyForeignKeyRenames } = await import("./push-legacy-renames-
|
|
1773
|
+
const { legacyForeignKeyRenames } = await import("./push-legacy-renames-CvWSBxRu.js");
|
|
1774
1774
|
const tables = await loadTables(schemaDir);
|
|
1775
1775
|
renames = await withAppClient(databaseUrl, (client) => legacyForeignKeyRenames({ query: async (text) => ({ rows: (await client.query(text)).rows }) }, tables));
|
|
1776
1776
|
} catch {
|
|
@@ -1791,7 +1791,7 @@ async function adoptIdenticalIndexes(databaseUrl, schemaDir, dryRun) {
|
|
|
1791
1791
|
let adoptions;
|
|
1792
1792
|
try {
|
|
1793
1793
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
1794
|
-
const { pushIndexAdoptions } = await import("./push-index-adoption-
|
|
1794
|
+
const { pushIndexAdoptions } = await import("./push-index-adoption-DTLPk_5i.js");
|
|
1795
1795
|
const tables = await loadTables(schemaDir);
|
|
1796
1796
|
adoptions = await withAppClient(databaseUrl, (client) => pushIndexAdoptions({ query: async (text) => ({ rows: (await client.query(text)).rows }) }, tables));
|
|
1797
1797
|
} catch {
|
|
@@ -1810,7 +1810,7 @@ async function adoptIdenticalIndexes(databaseUrl, schemaDir, dryRun) {
|
|
|
1810
1810
|
async function reportKeptEnumLabels(databaseUrl, schemaDir) {
|
|
1811
1811
|
try {
|
|
1812
1812
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
1813
|
-
const { keptEnumLabels, formatKeptEnumLabelsNotice } = await import("./enum-labels-kept-
|
|
1813
|
+
const { keptEnumLabels, formatKeptEnumLabelsNotice } = await import("./enum-labels-kept-DrCueSHr.js");
|
|
1814
1814
|
const tables = await loadTables(schemaDir);
|
|
1815
1815
|
const kept = await withAppClient(databaseUrl, (client) => keptEnumLabels({ query: async (text) => ({ rows: (await client.query(text)).rows }) }, tables));
|
|
1816
1816
|
if (kept.length > 0) outWarn(chalk.yellow(formatKeptEnumLabelsNotice(kept)));
|
|
@@ -1820,7 +1820,7 @@ async function prebuildForeignKeyIndexes(databaseUrl, schemaDir, dryRun) {
|
|
|
1820
1820
|
let missing;
|
|
1821
1821
|
try {
|
|
1822
1822
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
1823
|
-
const { missingForeignKeyIndexes } = await import("./push-index-prebuild-
|
|
1823
|
+
const { missingForeignKeyIndexes } = await import("./push-index-prebuild-WP5272gZ.js");
|
|
1824
1824
|
const tables = await loadTables(schemaDir);
|
|
1825
1825
|
missing = await withAppClient(databaseUrl, (client) => missingForeignKeyIndexes({ query: async (text) => ({ rows: (await client.query(text)).rows }) }, tables));
|
|
1826
1826
|
} catch {
|
|
@@ -1830,7 +1830,7 @@ async function prebuildForeignKeyIndexes(databaseUrl, schemaDir, dryRun) {
|
|
|
1830
1830
|
if (missing.length === 0 || dryRun) return names;
|
|
1831
1831
|
out(chalk.gray(` Building ${missing.length} foreign-key index(es) on existing tables first — CONCURRENTLY, so writes go on:`));
|
|
1832
1832
|
try {
|
|
1833
|
-
const { buildDeferredIndexes } = await import("./deferred-index-build-
|
|
1833
|
+
const { buildDeferredIndexes } = await import("./deferred-index-build-Bz37bvxW.js").then((n) => n.r);
|
|
1834
1834
|
const outcome = await withAppClient(databaseUrl, (client) => buildDeferredIndexes(async () => ({
|
|
1835
1835
|
dedicated: true,
|
|
1836
1836
|
query: async (text) => ({ rows: (await client.query(text)).rows }),
|
|
@@ -1878,9 +1878,9 @@ async function lockManagedTables(databaseUrl, schemaDir) {
|
|
|
1878
1878
|
let unsecured;
|
|
1879
1879
|
let userRole;
|
|
1880
1880
|
try {
|
|
1881
|
-
const { lockTables } = await import("./ensure-policies-
|
|
1881
|
+
const { lockTables } = await import("./ensure-policies-C1UCom37.js");
|
|
1882
1882
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
1883
|
-
const { readRecordedRequestRoles } = await import("./rls-enforcement-
|
|
1883
|
+
const { readRecordedRequestRoles } = await import("./rls-enforcement-NZKe3Jr-.js").then((n) => n.y);
|
|
1884
1884
|
const { cliRlsSettings } = await import("./rls-settings-CmGK2U0a.js").then((n) => n.a);
|
|
1885
1885
|
const tables = await loadTables(schemaDir);
|
|
1886
1886
|
({unsecured, userRole} = await withAppClient(databaseUrl, async (client) => {
|
|
@@ -1944,7 +1944,7 @@ async function stampSchemaVersion(databaseUrl, schemaDir) {
|
|
|
1944
1944
|
async function ensureAuthTables(databaseUrl, schemaDir) {
|
|
1945
1945
|
try {
|
|
1946
1946
|
const { drizzle } = await import("drizzle-orm/node-postgres");
|
|
1947
|
-
const { ensureAuthTablesExist } = await import("./ensure-tables-
|
|
1947
|
+
const { ensureAuthTablesExist } = await import("./ensure-tables-BVUNi6uG.js").then((n) => n.n);
|
|
1948
1948
|
const { loadTableSchema } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
1949
1949
|
const { descriptors } = await loadTableSchema(schemaDir);
|
|
1950
1950
|
const authTable = descriptors.find((descriptor) => descriptor.auth !== void 0);
|
|
@@ -1963,7 +1963,7 @@ async function ensureRlsUserRole(databaseUrl) {
|
|
|
1963
1963
|
const schemas = ["public", "rebase"];
|
|
1964
1964
|
let rls;
|
|
1965
1965
|
try {
|
|
1966
|
-
rls = await import("./rls-enforcement-
|
|
1966
|
+
rls = await import("./rls-enforcement-NZKe3Jr-.js").then((n) => n.y);
|
|
1967
1967
|
} catch (err) {
|
|
1968
1968
|
outError(chalk.red(`\n ✗ Could not load the RLS provisioning module: ${err instanceof Error ? err.message : String(err)}`));
|
|
1969
1969
|
return;
|
|
@@ -2047,7 +2047,7 @@ async function applyPolicies(databaseUrl, schemaDir) {
|
|
|
2047
2047
|
*/
|
|
2048
2048
|
async function readAdminPoliciesLive(databaseUrl) {
|
|
2049
2049
|
try {
|
|
2050
|
-
const { adminPoliciesLiveForCli } = await import("./rls-enforcement-
|
|
2050
|
+
const { adminPoliciesLiveForCli } = await import("./rls-enforcement-NZKe3Jr-.js").then((n) => n.y);
|
|
2051
2051
|
return await withAppClient(databaseUrl, (client) => adminPoliciesLiveForCli(async (text) => (await client.query(text)).rows));
|
|
2052
2052
|
} catch {
|
|
2053
2053
|
return false;
|
|
@@ -2061,7 +2061,7 @@ async function readAdminPoliciesLive(databaseUrl) {
|
|
|
2061
2061
|
*/
|
|
2062
2062
|
async function dropStaleCompanions(databaseUrl, schemaDir, adminRoleAvailable) {
|
|
2063
2063
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
2064
|
-
const { dropStaleAdminRequestCompanions } = await import("./policy-drift-
|
|
2064
|
+
const { dropStaleAdminRequestCompanions } = await import("./policy-drift-B2Czzs2Z.js").then((n) => n.s);
|
|
2065
2065
|
const tables = await loadTables(schemaDir);
|
|
2066
2066
|
try {
|
|
2067
2067
|
const dropped = await withAppClient(databaseUrl, (client) => dropStaleAdminRequestCompanions(client, tables, { adminRoleAvailable }));
|
|
@@ -2080,7 +2080,7 @@ async function dropStaleCompanions(databaseUrl, schemaDir, adminRoleAvailable) {
|
|
|
2080
2080
|
*/
|
|
2081
2081
|
async function moveAdminPoliciesToPublic(databaseUrl, schemaDir) {
|
|
2082
2082
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
2083
|
-
const { moveMigratedAdminPoliciesToPublic } = await import("./migrate-policy-stamps-
|
|
2083
|
+
const { moveMigratedAdminPoliciesToPublic } = await import("./migrate-policy-stamps-D7BaYeKO.js");
|
|
2084
2084
|
const tables = await loadTables(schemaDir);
|
|
2085
2085
|
try {
|
|
2086
2086
|
if (await withAppClient(databaseUrl, (client) => moveMigratedAdminPoliciesToPublic({ query: async (text, values) => ({ rows: (await client.query(text, values)).rows }) }, tables, (message) => outWarn(chalk.yellow(` ⚠️ ${message}`)))) > 0) out(chalk.gray(` The server-or-admin policies are written TO public: the admin request roles are not set up for this database (\`rebase doctor --database\` says what is missing). A server boot that sets them up moves them TO ${REBASE_ADMIN_ROLE}.`));
|
|
@@ -2119,7 +2119,7 @@ async function policyStamping(databaseUrl, schemaDir, policiesSql, adminRoleAvai
|
|
|
2119
2119
|
try {
|
|
2120
2120
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
2121
2121
|
const { planTablePolicies } = await import("./generate-postgres-ddl-logic-CQof4iFH.js").then((n) => n.s);
|
|
2122
|
-
const { policyStampSql } = await import("./ensure-policies-
|
|
2122
|
+
const { policyStampSql } = await import("./ensure-policies-C1UCom37.js");
|
|
2123
2123
|
const { pinSearchPath } = await import("./connection-C1zXTPJq.js").then((n) => n.r);
|
|
2124
2124
|
return {
|
|
2125
2125
|
statements: stampableTables(planTablePolicies(await loadTables(schemaDir), { adminRoleAvailable }), policiesSql).map((plan) => policyStampSql(plan)).filter((statement) => statement !== void 0),
|
|
@@ -2137,7 +2137,7 @@ async function policyStamping(databaseUrl, schemaDir, policiesSql, adminRoleAvai
|
|
|
2137
2137
|
*/
|
|
2138
2138
|
async function readPolicyPushPlan(databaseUrl, schemaDir) {
|
|
2139
2139
|
try {
|
|
2140
|
-
const { formatPolicyPushPlan, planPolicyPush, summarizePolicyPushPlan } = await import("./push-policy-plan-
|
|
2140
|
+
const { formatPolicyPushPlan, planPolicyPush, summarizePolicyPushPlan } = await import("./push-policy-plan-D8HvHgPs.js");
|
|
2141
2141
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
2142
2142
|
const { pinSearchPath } = await import("./connection-C1zXTPJq.js").then((n) => n.r);
|
|
2143
2143
|
const tables = await loadTables(schemaDir);
|
|
@@ -2170,7 +2170,7 @@ async function readPolicyPushPlan(databaseUrl, schemaDir) {
|
|
|
2170
2170
|
*/
|
|
2171
2171
|
async function reconcilePolicies(databaseUrl, schemaDir) {
|
|
2172
2172
|
try {
|
|
2173
|
-
const { checkPolicyDrift, dropOrphanedPolicies, formatPolicyDrift, hasDrift } = await import("./policy-drift-
|
|
2173
|
+
const { checkPolicyDrift, dropOrphanedPolicies, formatPolicyDrift, hasDrift } = await import("./policy-drift-B2Czzs2Z.js").then((n) => n.s);
|
|
2174
2174
|
const { loadTables } = await import("./load-tables-B1Re74ng.js").then((n) => n.i);
|
|
2175
2175
|
const tables = await loadTables(schemaDir);
|
|
2176
2176
|
const adminRoleAvailable = await readAdminPoliciesLive(databaseUrl);
|
|
@@ -2260,7 +2260,7 @@ async function branchCommand(rawArgs) {
|
|
|
2260
2260
|
process.exit(1);
|
|
2261
2261
|
}
|
|
2262
2262
|
const { DatabasePoolManager } = await import("./databasePoolManager-DIjzlTK4.js").then((n) => n.n);
|
|
2263
|
-
const { BranchService, reopenClosedDatabases, reopenedDatabasesNotice } = await import("./BranchService-
|
|
2263
|
+
const { BranchService, reopenClosedDatabases, reopenedDatabasesNotice } = await import("./BranchService-BLcVK_Rd.js").then((n) => n.n);
|
|
2264
2264
|
const { drizzle } = await import("drizzle-orm/node-postgres");
|
|
2265
2265
|
const { Pool } = await import("pg");
|
|
2266
2266
|
const healed = await reopenClosedDatabases(databaseUrl, [branchAction === "create" ? createSource(rawArgs) : void 0, process.env[ACTIVE_BRANCH_DATABASE_ENV]]);
|
|
@@ -3008,6 +3008,7 @@ async function schemaCommand(subcommand, rawArgs, options = {}) {
|
|
|
3008
3008
|
"--schema": String,
|
|
3009
3009
|
"--data-inference": Boolean,
|
|
3010
3010
|
"--no-data-inference": Boolean,
|
|
3011
|
+
"--from": String,
|
|
3011
3012
|
"-f": "--force"
|
|
3012
3013
|
}, {
|
|
3013
3014
|
argv: rawArgs.slice(2),
|
|
@@ -3029,7 +3030,8 @@ async function schemaCommand(subcommand, rawArgs, options = {}) {
|
|
|
3029
3030
|
...argsList["--force"] ? ["--force"] : [],
|
|
3030
3031
|
...argsList["--schema"] ? [`--schema=${argsList["--schema"]}`] : [],
|
|
3031
3032
|
...argsList["--data-inference"] ? ["--data-inference"] : [],
|
|
3032
|
-
...argsList["--no-data-inference"] ? ["--no-data-inference"] : []
|
|
3033
|
+
...argsList["--no-data-inference"] ? ["--no-data-inference"] : [],
|
|
3034
|
+
...argsList["--from"] ? [`--from=${argsList["--from"]}`] : []
|
|
3033
3035
|
];
|
|
3034
3036
|
try {
|
|
3035
3037
|
await execa(cmdParts[0], cmdParts.slice(1), {
|