@akal/supaforge 0.0.35 → 0.0.37
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/README.md +4 -1
- package/dist/base-command.js +4 -4
- package/dist/{chunk-SM7HP6EP.js → chunk-5UHIWFQG.js} +69 -9
- package/dist/{chunk-O5ERC2SE.js → chunk-AL6INEFX.js} +3 -3
- package/dist/{chunk-4AGJRRBT.js → chunk-CAQ3QQFP.js} +70 -22
- package/dist/{chunk-5Q6LSLA3.js → chunk-CCB7ARZU.js} +6 -6
- package/dist/{chunk-YZM76W22.js → chunk-EWNZIRCD.js} +4 -4
- package/dist/{chunk-YWERIWFD.js → chunk-FD2JKEJA.js} +5 -5
- package/dist/{chunk-NEM5AEPQ.js → chunk-GGZ7YWBZ.js} +24 -15
- package/dist/{chunk-7N63OPFN.js → chunk-JX5L253P.js} +46 -16
- package/dist/{chunk-GQPGH6YR.js → chunk-KHXEES2M.js} +2 -2
- package/dist/{chunk-4M6OQLPO.js → chunk-KT7NMELZ.js} +77 -7
- package/dist/{chunk-44UVQJV2.js → chunk-M2564IGT.js} +22 -15
- package/dist/{chunk-H2D3YSKM.js → chunk-MRXIE55Y.js} +3 -3
- package/dist/{chunk-NX2KKUS7.js → chunk-MZPWRWBL.js} +7 -7
- package/dist/{chunk-XLZCX6R2.js → chunk-OXS42LJH.js} +4 -4
- package/dist/{chunk-HNJ6BNNZ.js → chunk-Q43MN6NE.js} +2 -2
- package/dist/{chunk-ZI435CAU.js → chunk-RQCXGO37.js} +2 -2
- package/dist/{chunk-KNXHLVF7.js → chunk-SQ52YBKK.js} +3 -2
- package/dist/{chunk-T7GMPGUO.js → chunk-YUJ2MHLM.js} +674 -22
- package/dist/{chunk-AGONS5JJ.js → chunk-Z2YUOA4W.js} +2 -2
- package/dist/commands/clone.js +8 -8
- package/dist/commands/diff.d.ts +1 -0
- package/dist/commands/diff.js +14 -15
- package/dist/commands/hukam.js +14 -15
- package/dist/commands/init.js +2 -2
- package/dist/commands/mcp.js +9 -10
- package/dist/commands/migrate/baseline.js +5 -5
- package/dist/commands/migrate/create.js +22 -13
- package/dist/commands/migrate/list.js +5 -5
- package/dist/commands/migrate/run.js +9 -9
- package/dist/commands/report.js +5 -5
- package/dist/commands/restore.js +14 -13
- package/dist/commands/snapshot.js +8 -8
- package/dist/commands/sync.js +14 -15
- package/dist/index.d.ts +17 -0
- package/dist/index.js +13 -14
- package/package.json +2 -2
- package/dist/chunk-WNTCZM2J.js +0 -468
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadMigrations
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EWNZIRCD.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureMigrationsTable,
|
|
6
6
|
getAppliedVersions
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
PLATFORM_ROLES
|
|
10
|
-
} from "./chunk-WNTCZM2J.js";
|
|
7
|
+
} from "./chunk-AL6INEFX.js";
|
|
11
8
|
import {
|
|
12
9
|
dropUnsupportedSetStatements,
|
|
13
10
|
knownParameters
|
|
14
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GGZ7YWBZ.js";
|
|
15
12
|
import {
|
|
16
13
|
ABSENT_ON_TARGET,
|
|
17
14
|
EXTENSION_UNAVAILABLE,
|
|
15
|
+
OLDER_SERVER,
|
|
16
|
+
PLATFORM_ROLES,
|
|
17
|
+
estimateLocks,
|
|
18
|
+
lockBudgetWarning,
|
|
19
|
+
readLockBudget,
|
|
18
20
|
rolesNamedBy,
|
|
19
21
|
sqlSkeleton,
|
|
20
22
|
statementSubject
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-YUJ2MHLM.js";
|
|
22
24
|
import {
|
|
23
25
|
isCommentOnly,
|
|
24
26
|
isPsqlMetaCommand,
|
|
@@ -27,20 +29,20 @@ import {
|
|
|
27
29
|
} from "./chunk-WK5YTINL.js";
|
|
28
30
|
import {
|
|
29
31
|
loadSnapshot
|
|
30
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-5UHIWFQG.js";
|
|
31
33
|
import {
|
|
32
34
|
newPgClient,
|
|
33
35
|
pgQuery,
|
|
34
36
|
quoteIdent,
|
|
35
37
|
quoteLiteral,
|
|
36
38
|
quoteName
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-KT7NMELZ.js";
|
|
38
40
|
import {
|
|
39
41
|
DEFAULT_IGNORE_SCHEMAS,
|
|
40
42
|
MIGRATIONS_TABLE,
|
|
41
43
|
SUPABASE_PLATFORM_SCHEMAS,
|
|
42
44
|
errMsg
|
|
43
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-SQ52YBKK.js";
|
|
44
46
|
|
|
45
47
|
// src/restore.ts
|
|
46
48
|
import { readFile as readFile2, access } from "fs/promises";
|
|
@@ -354,6 +356,22 @@ async function resetRelationGrants(client, schemas) {
|
|
|
354
356
|
}
|
|
355
357
|
|
|
356
358
|
// src/restore.ts
|
|
359
|
+
async function snapshotIsNewer(snapshotDir, client) {
|
|
360
|
+
const head = (await readFile2(join2(snapshotDir, "schema.sql"), "utf-8").catch(() => "")).slice(0, 2e3);
|
|
361
|
+
const dumped = /Dumped from database version (\d+)/.exec(head)?.[1];
|
|
362
|
+
if (!dumped) return false;
|
|
363
|
+
const { rows: [row] } = await client.query(`SELECT current_setting('server_version_num') AS v`);
|
|
364
|
+
return Number(dumped) > Math.floor(Number(row?.v ?? 0) / 1e4);
|
|
365
|
+
}
|
|
366
|
+
async function locksForSnapshot(snapshotDir, layers, manifest) {
|
|
367
|
+
const statements = [];
|
|
368
|
+
for (const layer of layers) {
|
|
369
|
+
if (!manifest.layers[layer === "storage-policies" ? "storage" : layer]?.captured) continue;
|
|
370
|
+
const raw = await readFile2(join2(snapshotDir, layerRestoreFile(layer)), "utf-8").catch(() => "");
|
|
371
|
+
statements.push(...extractExecutableStatements(raw));
|
|
372
|
+
}
|
|
373
|
+
return estimateLocks(statements);
|
|
374
|
+
}
|
|
357
375
|
async function getPublicTables(targetUrl) {
|
|
358
376
|
const ignoreList = DEFAULT_IGNORE_SCHEMAS.map((s) => `'${s}'`).join(", ");
|
|
359
377
|
const client = newPgClient(targetUrl);
|
|
@@ -377,8 +395,17 @@ async function restoreFromSnapshot(options) {
|
|
|
377
395
|
const sqlOrder = RESTORE_SQL_ORDER;
|
|
378
396
|
const client = newPgClient(options.targetUrl);
|
|
379
397
|
await client.connect();
|
|
398
|
+
const olderTarget = await snapshotIsNewer(options.snapshotDir, client);
|
|
380
399
|
const transactional = !options.noTransaction;
|
|
381
|
-
if (transactional)
|
|
400
|
+
if (transactional) {
|
|
401
|
+
const warning = lockBudgetWarning(
|
|
402
|
+
await locksForSnapshot(options.snapshotDir, sqlOrder, manifest),
|
|
403
|
+
await readLockBudget(client),
|
|
404
|
+
"This restore"
|
|
405
|
+
);
|
|
406
|
+
if (warning) result.warnings = [warning];
|
|
407
|
+
await client.query("BEGIN");
|
|
408
|
+
}
|
|
382
409
|
const missing = /* @__PURE__ */ new Set();
|
|
383
410
|
const leftOut = /* @__PURE__ */ new Map();
|
|
384
411
|
const createdBySchemaLayer = /* @__PURE__ */ new Set();
|
|
@@ -459,7 +486,7 @@ async function restoreFromSnapshot(options) {
|
|
|
459
486
|
}
|
|
460
487
|
}
|
|
461
488
|
for (const sql of statements) {
|
|
462
|
-
await applyStatement(client, sql, transactional, result, missing, leftOut);
|
|
489
|
+
await applyStatement(client, sql, transactional, result, missing, leftOut, olderTarget);
|
|
463
490
|
}
|
|
464
491
|
} catch (err) {
|
|
465
492
|
if (err instanceof RestoreAborted) throw err;
|
|
@@ -746,10 +773,13 @@ function mentionedPlatformSchema(sql, targetSchemas) {
|
|
|
746
773
|
return SUPABASE_ONLY_SCHEMAS.find((schema) => !targetSchemas.has(schema) && new RegExp(String.raw`(?:"${schema}"|\b${schema})\s*\.`, "i").test(skeleton));
|
|
747
774
|
}
|
|
748
775
|
var ATTACHMENT = new RegExp(String.raw`^\s*(?:` + String.raw`GRANT|REVOKE|COMMENT\s+ON|SELECT|ALTER\s+PUBLICATION|ALTER\s+DEFAULT\s+PRIVILEGES|` + String.raw`ALTER\s+POLICY|ALTER\s+TABLE\s+(?:ONLY\s+)?\S+\s+ADD\s+CONSTRAINT\b[\s\S]*\bFOREIGN\s+KEY|` + String.raw`CREATE\s+(?:OR\s+REPLACE\s+)?(?:POLICY|(?:CONSTRAINT\s+)?TRIGGER|VIEW|MATERIALIZED\s+VIEW|RULE)` + String.raw`)\b`, "i");
|
|
749
|
-
function tolerableFailure(sql, err, targetSchemas, missing = /* @__PURE__ */ new Set(), leftOut = /* @__PURE__ */ new Map()) {
|
|
776
|
+
function tolerableFailure(sql, err, targetSchemas, missing = /* @__PURE__ */ new Set(), leftOut = /* @__PURE__ */ new Map(), olderTarget = false) {
|
|
750
777
|
const code = err?.code;
|
|
751
778
|
if (!code) return void 0;
|
|
752
779
|
const skeleton = sqlSkeleton(sql);
|
|
780
|
+
if (olderTarget && OLDER_SERVER.has(code)) {
|
|
781
|
+
return `this server's PostgreSQL is older than the snapshot's and does not support it: ${errMsg(err)}`;
|
|
782
|
+
}
|
|
753
783
|
if (/^\s*CREATE\s+EXTENSION\b/i.test(skeleton)) {
|
|
754
784
|
return EXTENSION_UNAVAILABLE.has(code) ? `extension not available on this server: ${errMsg(err)}` : void 0;
|
|
755
785
|
}
|
|
@@ -784,7 +814,7 @@ function createdObjects(sql) {
|
|
|
784
814
|
const bare = (n) => n.replace(/^"|"$/g, "");
|
|
785
815
|
return [`${m[1] ? bare(m[1]) : "public"}.${bare(m[2])}`];
|
|
786
816
|
}
|
|
787
|
-
async function applyStatement(client, sql, transactional, result, missing, leftOut = /* @__PURE__ */ new Map()) {
|
|
817
|
+
async function applyStatement(client, sql, transactional, result, missing, leftOut = /* @__PURE__ */ new Map(), olderTarget = false) {
|
|
788
818
|
if (transactional) await client.query("SAVEPOINT sf_restore_statement");
|
|
789
819
|
try {
|
|
790
820
|
const needed = extensionTargetSchema(sql);
|
|
@@ -797,7 +827,7 @@ async function applyStatement(client, sql, transactional, result, missing, leftO
|
|
|
797
827
|
if (transactional) await client.query("ROLLBACK TO SAVEPOINT sf_restore_statement");
|
|
798
828
|
const { rows } = await client.query("SELECT nspname FROM pg_namespace");
|
|
799
829
|
const targetSchemas = new Set(rows.map((r) => r.nspname));
|
|
800
|
-
const tolerated = tolerableFailure(sql, err, targetSchemas, missing, leftOut);
|
|
830
|
+
const tolerated = tolerableFailure(sql, err, targetSchemas, missing, leftOut, olderTarget);
|
|
801
831
|
if (tolerated) {
|
|
802
832
|
result.skipped.push({ type: "sql", label: summarizeStatement(sql), reason: tolerated });
|
|
803
833
|
const cause = /(this target lacks .+)$/.exec(tolerated)?.[1] ?? tolerated;
|
|
@@ -872,4 +902,4 @@ export {
|
|
|
872
902
|
previewMigrationRestore,
|
|
873
903
|
summarizeStatement
|
|
874
904
|
};
|
|
875
|
-
//# sourceMappingURL=chunk-
|
|
905
|
+
//# sourceMappingURL=chunk-JX5L253P.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeFailure,
|
|
3
3
|
redactUrls
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SQ52YBKK.js";
|
|
5
5
|
|
|
6
6
|
// src/process-guard.ts
|
|
7
7
|
var installed = false;
|
|
@@ -47,4 +47,4 @@ export {
|
|
|
47
47
|
keepRunningOnStrayErrors,
|
|
48
48
|
installProcessGuard
|
|
49
49
|
};
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-KHXEES2M.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ok,
|
|
13
13
|
redactUrls,
|
|
14
14
|
warn
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SQ52YBKK.js";
|
|
16
16
|
|
|
17
17
|
// src/db.ts
|
|
18
18
|
import pg from "pg";
|
|
@@ -60,18 +60,83 @@ function poolFor(dbUrl) {
|
|
|
60
60
|
pools.set(dbUrl, pool);
|
|
61
61
|
return pool;
|
|
62
62
|
}
|
|
63
|
+
var snapshots = /* @__PURE__ */ new Map();
|
|
64
|
+
var readAlone = false;
|
|
65
|
+
function setSnapshotsOff(off) {
|
|
66
|
+
readAlone = off;
|
|
67
|
+
}
|
|
68
|
+
function snapshotsOff() {
|
|
69
|
+
return readAlone;
|
|
70
|
+
}
|
|
71
|
+
var joined = /* @__PURE__ */ new WeakMap();
|
|
72
|
+
async function holdSnapshot(dbUrl) {
|
|
73
|
+
if (snapshots.has(dbUrl)) return true;
|
|
74
|
+
const anchor = newPgClient(dbUrl);
|
|
75
|
+
try {
|
|
76
|
+
await anchor.connect();
|
|
77
|
+
await anchor.query("BEGIN ISOLATION LEVEL REPEATABLE READ, READ ONLY");
|
|
78
|
+
const { rows: [row] } = await anchor.query("SELECT pg_export_snapshot() AS id");
|
|
79
|
+
snapshots.set(dbUrl, { id: row.id, anchor });
|
|
80
|
+
return true;
|
|
81
|
+
} catch {
|
|
82
|
+
await anchor.end().catch(() => void 0);
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function heldSnapshot(dbUrl) {
|
|
87
|
+
return snapshots.get(dbUrl)?.id;
|
|
88
|
+
}
|
|
89
|
+
async function releaseSnapshots() {
|
|
90
|
+
const held = [...snapshots.entries()];
|
|
91
|
+
snapshots.clear();
|
|
92
|
+
await Promise.all(held.map(async ([dbUrl, { anchor }]) => {
|
|
93
|
+
const pool = pools.get(dbUrl);
|
|
94
|
+
pools.delete(dbUrl);
|
|
95
|
+
await pool?.end().catch(() => void 0);
|
|
96
|
+
await anchor.end().catch(() => void 0);
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
async function connectionFor(dbUrl) {
|
|
100
|
+
const client = await poolFor(dbUrl).connect();
|
|
101
|
+
const id = snapshots.get(dbUrl)?.id;
|
|
102
|
+
if (id && joined.get(client) !== id) {
|
|
103
|
+
try {
|
|
104
|
+
await client.query(`BEGIN ISOLATION LEVEL REPEATABLE READ; SET TRANSACTION SNAPSHOT '${id.replace(/'/g, "''")}'`);
|
|
105
|
+
joined.set(client, id);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
await client.query("ROLLBACK").catch(() => void 0);
|
|
108
|
+
client.release();
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return client;
|
|
113
|
+
}
|
|
63
114
|
var pgQuery = async (dbUrl, sql, params) => {
|
|
64
|
-
|
|
65
|
-
|
|
115
|
+
if (!snapshots.has(dbUrl)) {
|
|
116
|
+
const { rows } = await poolFor(dbUrl).query(sql, params);
|
|
117
|
+
return rows;
|
|
118
|
+
}
|
|
119
|
+
const client = await connectionFor(dbUrl);
|
|
120
|
+
try {
|
|
121
|
+
const { rows } = await client.query(sql, params);
|
|
122
|
+
return rows;
|
|
123
|
+
} catch (err) {
|
|
124
|
+
await client.query("ROLLBACK").catch(() => void 0);
|
|
125
|
+
joined.delete(client);
|
|
126
|
+
throw err;
|
|
127
|
+
} finally {
|
|
128
|
+
client.release();
|
|
129
|
+
}
|
|
66
130
|
};
|
|
67
131
|
async function inRolledBackTransaction(dbUrl, fn) {
|
|
68
|
-
const client = await
|
|
132
|
+
const client = await connectionFor(dbUrl);
|
|
133
|
+
const [begin, undo] = joined.has(client) ? ["SAVEPOINT sf_scratch", "ROLLBACK TO SAVEPOINT sf_scratch"] : ["BEGIN", "ROLLBACK"];
|
|
69
134
|
try {
|
|
70
|
-
await client.query(
|
|
135
|
+
await client.query(begin);
|
|
71
136
|
try {
|
|
72
137
|
return await fn(client);
|
|
73
138
|
} finally {
|
|
74
|
-
await client.query(
|
|
139
|
+
await client.query(undo).catch(() => void 0);
|
|
75
140
|
}
|
|
76
141
|
} finally {
|
|
77
142
|
client.release();
|
|
@@ -535,6 +600,11 @@ export {
|
|
|
535
600
|
pgClientConfig,
|
|
536
601
|
newPgClient,
|
|
537
602
|
newPgPool,
|
|
603
|
+
setSnapshotsOff,
|
|
604
|
+
snapshotsOff,
|
|
605
|
+
holdSnapshot,
|
|
606
|
+
heldSnapshot,
|
|
607
|
+
releaseSnapshots,
|
|
538
608
|
pgQuery,
|
|
539
609
|
inRolledBackTransaction,
|
|
540
610
|
DEFAULT_LOCAL_PORT,
|
|
@@ -555,4 +625,4 @@ export {
|
|
|
555
625
|
MigrationsCheck,
|
|
556
626
|
readLocalMigrations
|
|
557
627
|
};
|
|
558
|
-
//# sourceMappingURL=chunk-
|
|
628
|
+
//# sourceMappingURL=chunk-KT7NMELZ.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sanitizeForReport
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q43MN6NE.js";
|
|
4
4
|
import {
|
|
5
5
|
coverage,
|
|
6
6
|
formatSkips,
|
|
7
7
|
renderDetailed,
|
|
8
8
|
renderSummary
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MRXIE55Y.js";
|
|
10
10
|
import {
|
|
11
11
|
createDefaultRegistry,
|
|
12
12
|
scan,
|
|
13
13
|
summarizeByKind
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CAQ3QQFP.js";
|
|
15
15
|
import {
|
|
16
16
|
comparedSchemas,
|
|
17
17
|
copyStructure,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
psqlBeside,
|
|
22
22
|
residualHeldBack,
|
|
23
23
|
withDatabase
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-GGZ7YWBZ.js";
|
|
25
25
|
import {
|
|
26
26
|
CHECK_META,
|
|
27
27
|
CHECK_NAMES,
|
|
@@ -30,32 +30,32 @@ import {
|
|
|
30
30
|
planWork,
|
|
31
31
|
promote,
|
|
32
32
|
resolveTableFilter
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-YUJ2MHLM.js";
|
|
34
34
|
import {
|
|
35
35
|
isCommentOnly,
|
|
36
36
|
splitSqlStatements
|
|
37
37
|
} from "./chunk-WK5YTINL.js";
|
|
38
38
|
import {
|
|
39
39
|
renderTip
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-RQCXGO37.js";
|
|
41
41
|
import {
|
|
42
42
|
BaseCommand
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-OXS42LJH.js";
|
|
44
44
|
import {
|
|
45
45
|
isCloneDatabase,
|
|
46
46
|
sourceLooksLikeCloneOf
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-FD2JKEJA.js";
|
|
48
48
|
import {
|
|
49
49
|
describeMissingPgDump,
|
|
50
50
|
getServerMajorVersion,
|
|
51
51
|
parseFlagList,
|
|
52
52
|
resolvePgDumpPath
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-Z2YUOA4W.js";
|
|
54
54
|
import {
|
|
55
55
|
Preflight,
|
|
56
56
|
pgQuery,
|
|
57
57
|
quoteName
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-KT7NMELZ.js";
|
|
59
59
|
import {
|
|
60
60
|
CLONE_SKIP_FLAGS,
|
|
61
61
|
DEFAULT_IGNORE_SCHEMAS,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
redactUrls,
|
|
71
71
|
schemaDiffIgnores,
|
|
72
72
|
warn
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-SQ52YBKK.js";
|
|
74
74
|
|
|
75
75
|
// src/commands/diff.ts
|
|
76
76
|
import { Flags } from "@oclif/core";
|
|
@@ -323,6 +323,10 @@ var Diff = class _Diff extends BaseCommand {
|
|
|
323
323
|
description: "With --apply, print the fixes in the order they would run without executing any of them",
|
|
324
324
|
default: false
|
|
325
325
|
}),
|
|
326
|
+
"no-snapshot": Flags.boolean({
|
|
327
|
+
description: "Read each query on its own, rather than each database as of one instant (which holds what it reads locked until the scan ends, as pg_dump does)",
|
|
328
|
+
default: false
|
|
329
|
+
}),
|
|
326
330
|
"no-transaction": Flags.boolean({
|
|
327
331
|
description: "With --apply, run each fix on its own instead of rolling the whole set back on the first failure",
|
|
328
332
|
aliases: ["continue-on-error"],
|
|
@@ -379,12 +383,14 @@ var Diff = class _Diff extends BaseCommand {
|
|
|
379
383
|
*/
|
|
380
384
|
renderApplyResult(result, dryRun) {
|
|
381
385
|
const verb = dryRun ? "Would apply" : "Applied";
|
|
386
|
+
for (const warning of result.warnings ?? []) this.log(`${warn(warning)}
|
|
387
|
+
`);
|
|
382
388
|
if (result.applied.length > 0) {
|
|
383
389
|
const heading = `${verb} ${result.applied.length} fix(es)${dryRun ? ", in this order" : ""}:`;
|
|
384
390
|
this.log(dryRun ? bold(heading) : ok(heading));
|
|
385
391
|
result.applied.forEach((stmt, i) => {
|
|
386
392
|
const glyph = dryRun ? dim(`${i + 1}.`) : ok("\u2713");
|
|
387
|
-
this.log(` ${glyph} ${dim(`[${stmt.check}]`)} ${stmt.issueId}`);
|
|
393
|
+
this.log(` ${glyph} ${dim(`[${stmt.check}]`)} ${stmt.issueId}${stmt.note ? dim(` \u2014 ${stmt.note}`) : ""}`);
|
|
388
394
|
if (dryRun && stmt.sql) this.log(` ${dim(stmt.sql.replace(/\s*\n\s*/g, " "))}`);
|
|
389
395
|
if (dryRun && stmt.action) this.log(` ${dim(stmt.action)}`);
|
|
390
396
|
});
|
|
@@ -486,7 +492,7 @@ ${warn(`${result.errors.length} error(s):`)}`);
|
|
|
486
492
|
};
|
|
487
493
|
if (flags.apply || flags["dry-run"]) {
|
|
488
494
|
const onProgress2 = makeProgress();
|
|
489
|
-
const scanResult = await scan(registry, { config, checks, skip, tableFilter, onProgress: onProgress2, onDetail: makeDetail() });
|
|
495
|
+
const scanResult = await scan(registry, { config, checks, skip, tableFilter, onProgress: onProgress2, onDetail: makeDetail(), snapshot: !flags["no-snapshot"] });
|
|
490
496
|
this.setCheckSummaries(scanResult.checks.map((c) => ({
|
|
491
497
|
check: c.check,
|
|
492
498
|
status: c.status,
|
|
@@ -584,6 +590,7 @@ ${warn(`${result.errors.length} error(s):`)}`);
|
|
|
584
590
|
}
|
|
585
591
|
const result2 = await promote({
|
|
586
592
|
dbUrl: targetEnv.dbUrl,
|
|
593
|
+
sourceUrl: config.environments[config.source]?.dbUrl,
|
|
587
594
|
scanResult,
|
|
588
595
|
checks,
|
|
589
596
|
dryRun,
|
|
@@ -612,7 +619,7 @@ ${warn(`${result.errors.length} error(s):`)}`);
|
|
|
612
619
|
return;
|
|
613
620
|
}
|
|
614
621
|
const onProgress = makeProgress();
|
|
615
|
-
const result = await scan(registry, { config, checks, skip, tableFilter, onProgress, onDetail: makeDetail() });
|
|
622
|
+
const result = await scan(registry, { config, checks, skip, tableFilter, onProgress, onDetail: makeDetail(), snapshot: !flags["no-snapshot"] });
|
|
616
623
|
this.setCheckSummaries(result.checks.map((c) => ({
|
|
617
624
|
check: c.check,
|
|
618
625
|
status: c.status,
|
|
@@ -770,4 +777,4 @@ export {
|
|
|
770
777
|
inertApplyFlags,
|
|
771
778
|
Diff
|
|
772
779
|
};
|
|
773
|
-
//# sourceMappingURL=chunk-
|
|
780
|
+
//# sourceMappingURL=chunk-M2564IGT.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CHECK_META,
|
|
3
3
|
isComparisonCheck
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YUJ2MHLM.js";
|
|
5
5
|
import {
|
|
6
6
|
CHECK_LINE_PADDING,
|
|
7
7
|
bold,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
dim,
|
|
10
10
|
ok,
|
|
11
11
|
warn
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SQ52YBKK.js";
|
|
13
13
|
|
|
14
14
|
// src/render.ts
|
|
15
15
|
function countErrored(result) {
|
|
@@ -241,4 +241,4 @@ export {
|
|
|
241
241
|
renderDetailed,
|
|
242
242
|
formatSkips
|
|
243
243
|
};
|
|
244
|
-
//# sourceMappingURL=chunk-
|
|
244
|
+
//# sourceMappingURL=chunk-MRXIE55Y.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
backup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EWNZIRCD.js";
|
|
4
4
|
import {
|
|
5
5
|
createDefaultRegistry,
|
|
6
6
|
scan
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CAQ3QQFP.js";
|
|
8
8
|
import {
|
|
9
9
|
CHECK_NAMES,
|
|
10
10
|
promote
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YUJ2MHLM.js";
|
|
12
12
|
import {
|
|
13
13
|
captureSnapshot,
|
|
14
14
|
unrestorableSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5UHIWFQG.js";
|
|
16
16
|
import {
|
|
17
17
|
checkConnection
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-KT7NMELZ.js";
|
|
19
19
|
import {
|
|
20
20
|
describeFailure,
|
|
21
21
|
redactUrls,
|
|
22
22
|
resolveConfig,
|
|
23
23
|
validateConfig
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-SQ52YBKK.js";
|
|
25
25
|
|
|
26
26
|
// src/mcp/state.ts
|
|
27
27
|
var lastScanResult = null;
|
|
@@ -504,4 +504,4 @@ export {
|
|
|
504
504
|
clearLastScanResult,
|
|
505
505
|
createServer
|
|
506
506
|
};
|
|
507
|
-
//# sourceMappingURL=chunk-
|
|
507
|
+
//# sourceMappingURL=chunk-MZPWRWBL.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_MIGRATIONS_DIR,
|
|
3
3
|
Preflight
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KT7NMELZ.js";
|
|
5
5
|
import {
|
|
6
6
|
installProcessGuard,
|
|
7
7
|
noteJsonWritten
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KHXEES2M.js";
|
|
9
9
|
import {
|
|
10
10
|
RUN_LOG_DIR,
|
|
11
11
|
RUN_LOG_FILE,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
redactUrls,
|
|
16
16
|
validateConfig,
|
|
17
17
|
validateSingleEnvConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SQ52YBKK.js";
|
|
19
19
|
|
|
20
20
|
// src/base-command.ts
|
|
21
21
|
import { formatWithOptions } from "util";
|
|
@@ -211,4 +211,4 @@ export {
|
|
|
211
211
|
readRunLog,
|
|
212
212
|
BaseCommand
|
|
213
213
|
};
|
|
214
|
-
//# sourceMappingURL=chunk-
|
|
214
|
+
//# sourceMappingURL=chunk-OXS42LJH.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
redactUrls
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SQ52YBKK.js";
|
|
4
4
|
|
|
5
5
|
// src/utils/sanitize.ts
|
|
6
6
|
function sanitizeForReport(text) {
|
|
@@ -10,4 +10,4 @@ function sanitizeForReport(text) {
|
|
|
10
10
|
export {
|
|
11
11
|
sanitizeForReport
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-Q43MN6NE.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
CLONE_SKIP_FLAGS,
|
|
3
3
|
cmd,
|
|
4
4
|
dim
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SQ52YBKK.js";
|
|
6
6
|
|
|
7
7
|
// src/tips.ts
|
|
8
8
|
function applyTip(sourceIsClone, driftedChecks) {
|
|
@@ -150,4 +150,4 @@ function renderTip(ctx) {
|
|
|
150
150
|
export {
|
|
151
151
|
renderTip
|
|
152
152
|
};
|
|
153
|
-
//# sourceMappingURL=chunk-
|
|
153
|
+
//# sourceMappingURL=chunk-RQCXGO37.js.map
|
|
@@ -139,7 +139,8 @@ function schemaDiffIgnores(ignoreSchemas = DEFAULT_IGNORE_SCHEMAS) {
|
|
|
139
139
|
...SUPABASE_PLATFORM_SCHEMAS.filter((s) => !DEFAULT_IGNORE_SCHEMAS.includes(s)),
|
|
140
140
|
"_realtime",
|
|
141
141
|
"_analytics",
|
|
142
|
-
"pgsodium_masks"
|
|
142
|
+
"pgsodium_masks",
|
|
143
|
+
"pgmq"
|
|
143
144
|
])];
|
|
144
145
|
}
|
|
145
146
|
var INIT_HINTS = {
|
|
@@ -455,4 +456,4 @@ export {
|
|
|
455
456
|
printHints,
|
|
456
457
|
printBanner
|
|
457
458
|
};
|
|
458
|
-
//# sourceMappingURL=chunk-
|
|
459
|
+
//# sourceMappingURL=chunk-SQ52YBKK.js.map
|