@akal/supaforge 0.0.43 → 0.0.44
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/{chunk-F2NXGOF3.js → chunk-DLTCJNJI.js} +4 -4
- package/dist/{chunk-GUNQ5FFO.js → chunk-DTTQWSSU.js} +3 -3
- package/dist/{chunk-M2OYKG65.js → chunk-FXBTUJON.js} +144 -1
- package/dist/{chunk-4PO4VB4C.js → chunk-HHM37KPD.js} +4 -4
- package/dist/{chunk-FGHBEOUV.js → chunk-HMTFOYDT.js} +3 -3
- package/dist/{chunk-HP4IDUCN.js → chunk-IHGINEPX.js} +2 -2
- package/dist/{chunk-DTLEH6LL.js → chunk-UC2Z5ISB.js} +2 -2
- package/dist/{chunk-45UBDKAH.js → chunk-WZALUV4T.js} +2 -2
- package/dist/{chunk-L72FDQ3K.js → chunk-ZJPJTC6R.js} +3 -123
- package/dist/commands/diff.js +4 -4
- package/dist/commands/hukam.js +4 -4
- package/dist/commands/mcp.js +5 -5
- package/dist/commands/migrate/create.js +4 -4
- package/dist/commands/migrate/run.js +3 -3
- package/dist/commands/restore.js +2 -2
- package/dist/commands/sync.js +4 -4
- package/dist/index.js +7 -7
- package/package.json +2 -2
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
formatSkips,
|
|
7
7
|
renderDetailed,
|
|
8
8
|
renderSummary
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WZALUV4T.js";
|
|
10
10
|
import {
|
|
11
11
|
createDefaultRegistry,
|
|
12
12
|
proveBeforeApply,
|
|
13
13
|
scan,
|
|
14
14
|
summarizeByKind
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZJPJTC6R.js";
|
|
16
16
|
import {
|
|
17
17
|
CHECK_META,
|
|
18
18
|
CHECK_NAMES,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
psqlBeside,
|
|
25
25
|
resolveTableFilter,
|
|
26
26
|
withDatabase
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-FXBTUJON.js";
|
|
28
28
|
import {
|
|
29
29
|
isCommentOnly,
|
|
30
30
|
splitSqlStatements
|
|
@@ -756,4 +756,4 @@ export {
|
|
|
756
756
|
inertApplyFlags,
|
|
757
757
|
Diff
|
|
758
758
|
};
|
|
759
|
-
//# sourceMappingURL=chunk-
|
|
759
|
+
//# sourceMappingURL=chunk-DLTCJNJI.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
targetFingerprint,
|
|
3
3
|
writtenAgainst
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UC2Z5ISB.js";
|
|
5
5
|
import {
|
|
6
6
|
ensureMigrationsTable,
|
|
7
7
|
getAppliedVersions,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-HWRRFF55.js";
|
|
11
11
|
import {
|
|
12
12
|
isDestructiveSql
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FXBTUJON.js";
|
|
14
14
|
import {
|
|
15
15
|
splitSqlStatements
|
|
16
16
|
} from "./chunk-WK5YTINL.js";
|
|
@@ -180,4 +180,4 @@ export {
|
|
|
180
180
|
findDestructiveStatements,
|
|
181
181
|
truncateSql
|
|
182
182
|
};
|
|
183
|
-
//# sourceMappingURL=chunk-
|
|
183
|
+
//# sourceMappingURL=chunk-DTTQWSSU.js.map
|
|
@@ -637,6 +637,127 @@ function diffGrants(source, target, missingRoles = /* @__PURE__ */ new Set()) {
|
|
|
637
637
|
return issues;
|
|
638
638
|
}
|
|
639
639
|
|
|
640
|
+
// src/checks/extensions.ts
|
|
641
|
+
var ExtensionsCheck = class extends Check {
|
|
642
|
+
constructor(queryFn = pgQuery) {
|
|
643
|
+
super();
|
|
644
|
+
this.queryFn = queryFn;
|
|
645
|
+
}
|
|
646
|
+
queryFn;
|
|
647
|
+
name = "extensions";
|
|
648
|
+
async scan(ctx) {
|
|
649
|
+
const [source, target, reachable] = await Promise.all([
|
|
650
|
+
this.fetchExtensions(ctx.source.dbUrl),
|
|
651
|
+
this.fetchExtensions(ctx.target.dbUrl),
|
|
652
|
+
this.fetchUpdates(ctx.target.dbUrl)
|
|
653
|
+
]);
|
|
654
|
+
const ignored = new Set(ctx.config.ignoreExtensions ?? []);
|
|
655
|
+
return diffExtensions(source, target.filter((e) => !ignored.has(e.name) || source.some((s) => s.name === e.name)), reachable);
|
|
656
|
+
}
|
|
657
|
+
/** The versions each installed extension can be updated to on this server. */
|
|
658
|
+
async fetchUpdates(dbUrl) {
|
|
659
|
+
try {
|
|
660
|
+
const rows = await this.queryFn(dbUrl, UPDATES_SQL);
|
|
661
|
+
const out = /* @__PURE__ */ new Map();
|
|
662
|
+
for (const r of rows) out.set(r.name, (out.get(r.name) ?? /* @__PURE__ */ new Set()).add(r.version));
|
|
663
|
+
return out;
|
|
664
|
+
} catch {
|
|
665
|
+
return void 0;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
async fetchExtensions(dbUrl) {
|
|
669
|
+
return await this.queryFn(dbUrl, EXTENSIONS_SQL);
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
var EXTENSIONS_SQL = `
|
|
673
|
+
SELECT e.extname AS name,
|
|
674
|
+
e.extversion AS version,
|
|
675
|
+
n.nspname AS schema
|
|
676
|
+
FROM pg_extension e
|
|
677
|
+
JOIN pg_namespace n ON n.oid = e.extnamespace
|
|
678
|
+
ORDER BY e.extname
|
|
679
|
+
`;
|
|
680
|
+
var UPDATES_SQL = `
|
|
681
|
+
SELECT e.extname AS name, p.target AS version
|
|
682
|
+
FROM pg_extension e
|
|
683
|
+
CROSS JOIN LATERAL pg_extension_update_paths(e.extname) p
|
|
684
|
+
WHERE p.source = e.extversion AND p.path IS NOT NULL
|
|
685
|
+
`;
|
|
686
|
+
var SUPABASE_PLATFORM_EXTENSIONS = [
|
|
687
|
+
{ name: "pg_graphql", schemas: ["graphql"] },
|
|
688
|
+
{ name: "supabase_vault", schemas: ["vault"] },
|
|
689
|
+
{ name: "pgsodium", schemas: ["pgsodium"] },
|
|
690
|
+
{ name: "pg_stat_statements", schemas: ["extensions"] },
|
|
691
|
+
{ name: "pgcrypto", schemas: ["extensions"] },
|
|
692
|
+
{ name: "pgjwt", schemas: ["extensions"] },
|
|
693
|
+
{ name: "uuid-ossp", schemas: ["extensions"] }
|
|
694
|
+
];
|
|
695
|
+
function isPlatformExtension(ext) {
|
|
696
|
+
return SUPABASE_PLATFORM_EXTENSIONS.some((p) => p.name === ext.name && p.schemas.includes(ext.schema));
|
|
697
|
+
}
|
|
698
|
+
function diffExtensions(source, target, reachable) {
|
|
699
|
+
const issues = [];
|
|
700
|
+
const sourceMap = new Map(source.map((e) => [e.name, e]));
|
|
701
|
+
const targetMap = new Map(target.map((e) => [e.name, e]));
|
|
702
|
+
for (const [name, ext] of sourceMap) {
|
|
703
|
+
if (!targetMap.has(name)) {
|
|
704
|
+
issues.push({
|
|
705
|
+
id: `ext-missing-${name}`,
|
|
706
|
+
check: "extensions",
|
|
707
|
+
severity: "warning",
|
|
708
|
+
title: `Missing extension: ${name}`,
|
|
709
|
+
description: `Extension "${name}" (v${ext.version}) is enabled in source (schema: ${ext.schema}) but not in target.`,
|
|
710
|
+
sourceValue: ext,
|
|
711
|
+
sql: {
|
|
712
|
+
// Into the schema it is in on the source, which plain PostgreSQL
|
|
713
|
+
// may not have — Supabase's `extensions`. Made first; if the server
|
|
714
|
+
// does not ship the extension, the fix is left out with it. A
|
|
715
|
+
// system schema (pg_cron's pg_catalog) is always there, and cannot
|
|
716
|
+
// be made.
|
|
717
|
+
up: ext.schema === "public" ? `CREATE EXTENSION IF NOT EXISTS ${quoteName(name)};` : `${ext.schema.startsWith("pg_") ? "" : `CREATE SCHEMA IF NOT EXISTS ${quoteName(ext.schema)};
|
|
718
|
+
`}CREATE EXTENSION IF NOT EXISTS ${quoteName(name)} SCHEMA ${quoteName(ext.schema)};`,
|
|
719
|
+
down: `DROP EXTENSION IF EXISTS ${quoteName(name)};`
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
for (const [name, ext] of targetMap) {
|
|
725
|
+
if (!sourceMap.has(name) && !isPlatformExtension(ext)) {
|
|
726
|
+
issues.push({
|
|
727
|
+
id: `ext-extra-${name}`,
|
|
728
|
+
check: "extensions",
|
|
729
|
+
severity: "info",
|
|
730
|
+
title: `Extra extension: ${name}`,
|
|
731
|
+
description: `Extension "${name}" (v${ext.version}) is enabled in target (schema: ${ext.schema}) but not in source.`,
|
|
732
|
+
targetValue: ext
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
for (const [name, srcExt] of sourceMap) {
|
|
737
|
+
const tgtExt = targetMap.get(name);
|
|
738
|
+
if (!tgtExt) continue;
|
|
739
|
+
if (srcExt.version !== tgtExt.version) {
|
|
740
|
+
const updatable = !reachable || reachable.get(name)?.has(srcExt.version);
|
|
741
|
+
issues.push({
|
|
742
|
+
id: `ext-version-${name}`,
|
|
743
|
+
check: "extensions",
|
|
744
|
+
severity: "info",
|
|
745
|
+
title: `Extension version mismatch: ${name}`,
|
|
746
|
+
description: `Extension "${name}" is v${srcExt.version} in source but v${tgtExt.version} in target.`,
|
|
747
|
+
sourceValue: srcExt,
|
|
748
|
+
targetValue: tgtExt,
|
|
749
|
+
...updatable ? {
|
|
750
|
+
sql: {
|
|
751
|
+
up: `ALTER EXTENSION ${quoteName(name)} UPDATE TO ${quoteLiteral(srcExt.version)};`,
|
|
752
|
+
down: `ALTER EXTENSION ${quoteName(name)} UPDATE TO ${quoteLiteral(tgtExt.version)};`
|
|
753
|
+
}
|
|
754
|
+
} : { manualOnly: `the target cannot go from v${tgtExt.version} to v${srcExt.version}: its server has no update path there (an extension cannot be moved down a version)` }
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return issues;
|
|
759
|
+
}
|
|
760
|
+
|
|
640
761
|
// src/sql-ast.ts
|
|
641
762
|
import { loadModule, parseSync } from "libpg-query";
|
|
642
763
|
await loadModule();
|
|
@@ -1397,11 +1518,31 @@ function platformDefaultPrivileges(sql) {
|
|
|
1397
1518
|
const name = role.startsWith('"') ? role.slice(1, -1).replace(/""/g, '"') : role.toLowerCase();
|
|
1398
1519
|
return name !== "postgres" && PLATFORM_ROLES.includes(name);
|
|
1399
1520
|
}
|
|
1521
|
+
function platformExtensionMove(upSql, downSql) {
|
|
1522
|
+
const re = /^\s*ALTER\s+EXTENSION\s+("(?:[^"]|"")+"|[\w$-]+)\s+SET\s+SCHEMA\s+("(?:[^"]|"")+"|[\w$]+)\s*;?\s*$/i;
|
|
1523
|
+
const up = re.exec(upSql);
|
|
1524
|
+
const down = re.exec(downSql);
|
|
1525
|
+
if (!up || !down) return void 0;
|
|
1526
|
+
const name = unquoted(up[1]);
|
|
1527
|
+
const targetSchema = unquoted(down[2]);
|
|
1528
|
+
if (unquoted(down[1]) !== name || !isPlatformExtension({ name, schema: targetSchema })) return void 0;
|
|
1529
|
+
return { name, sourceSchema: unquoted(up[2]), targetSchema };
|
|
1530
|
+
}
|
|
1400
1531
|
function issuesFromUnits(upUnits, downUnits, check, ignoreSchemas, ignoredSchemaTables) {
|
|
1401
1532
|
const pairs = pairUnits(upUnits, downUnits).filter(({ up, down }) => !(ignoreSchemas?.length && isCrossSchemaFkUnit(up, down, ignoreSchemas, ignoredSchemaTables)) && !platformDefaultPrivileges(up.sql));
|
|
1402
1533
|
return pairs.map(({ up, down }, i) => {
|
|
1403
1534
|
const upSql = up.sql;
|
|
1404
1535
|
const downSql = down?.sql ?? "";
|
|
1536
|
+
const platform = platformExtensionMove(upSql, downSql);
|
|
1537
|
+
if (platform) {
|
|
1538
|
+
return {
|
|
1539
|
+
id: `${check}-extension-schema-${i + 1}`,
|
|
1540
|
+
check,
|
|
1541
|
+
severity: "info",
|
|
1542
|
+
title: `Extension in another schema: ${platform.name}`,
|
|
1543
|
+
description: `Extension "${platform.name}" is in schema ${platform.sourceSchema} on the source and in ${platform.targetSchema} on the target, where Supabase installs it. It is the same extension, and what uses it works either way; nothing to apply.`
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1405
1546
|
const statements = splitStatements(upSql);
|
|
1406
1547
|
const replaced = replacedObject(up, statements);
|
|
1407
1548
|
const manualOnly = manualEnumChange(up);
|
|
@@ -1908,6 +2049,7 @@ var SCHEMA_RULES = [
|
|
|
1908
2049
|
{ match: /^\s*COMMENT\s+ON\b/i, label: "Comment changed", name: commentLabel },
|
|
1909
2050
|
{ match: /^\s*CREATE\s+EXTENSION\b/i, label: "Extension missing", name: extensionLabel },
|
|
1910
2051
|
{ match: /^\s*DROP\s+EXTENSION\b/i, label: "Extra extension", name: extensionLabel },
|
|
2052
|
+
{ match: /^\s*ALTER\s+EXTENSION\b[^;]*\bSET\s+SCHEMA\b/is, label: "Extension in another schema", name: extensionLabel },
|
|
1911
2053
|
{ match: /^\s*CREATE\s+COLLATION\b/i, label: "Collation missing", name: named(AFTER.collation) },
|
|
1912
2054
|
{ match: /^\s*ALTER\s+COLLATION\b/i, label: "Collation altered", name: named(AFTER.collation) },
|
|
1913
2055
|
{ match: /^\s*DROP\s+COLLATION\b/i, label: "Extra collation", name: named(AFTER.collation) },
|
|
@@ -3243,6 +3385,7 @@ export {
|
|
|
3243
3385
|
isComparisonCheck,
|
|
3244
3386
|
PLATFORM_ROLES,
|
|
3245
3387
|
RolesCheck,
|
|
3388
|
+
ExtensionsCheck,
|
|
3246
3389
|
runDbDiff,
|
|
3247
3390
|
isDestructiveSql,
|
|
3248
3391
|
destructiveReason,
|
|
@@ -3269,4 +3412,4 @@ export {
|
|
|
3269
3412
|
residualHeldBack,
|
|
3270
3413
|
proofScope
|
|
3271
3414
|
};
|
|
3272
|
-
//# sourceMappingURL=chunk-
|
|
3415
|
+
//# sourceMappingURL=chunk-FXBTUJON.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
migrationsDir,
|
|
3
3
|
writeMigrationFile
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HMTFOYDT.js";
|
|
5
5
|
import {
|
|
6
6
|
createDefaultRegistry,
|
|
7
7
|
proveBeforeApply,
|
|
8
8
|
scan
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZJPJTC6R.js";
|
|
10
10
|
import {
|
|
11
11
|
CHECK_NAMES,
|
|
12
12
|
promote
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FXBTUJON.js";
|
|
14
14
|
import {
|
|
15
15
|
captureSnapshot,
|
|
16
16
|
unrestorableSchema
|
|
@@ -530,4 +530,4 @@ export {
|
|
|
530
530
|
clearLastScanResult,
|
|
531
531
|
createServer
|
|
532
532
|
};
|
|
533
|
-
//# sourceMappingURL=chunk-
|
|
533
|
+
//# sourceMappingURL=chunk-HHM37KPD.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
targetFingerprint,
|
|
3
3
|
writtenAgainstLine
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UC2Z5ISB.js";
|
|
5
5
|
import {
|
|
6
6
|
RolesCheck,
|
|
7
7
|
isDestructiveSql,
|
|
8
8
|
runDbDiff
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FXBTUJON.js";
|
|
10
10
|
import {
|
|
11
11
|
splitSqlStatements
|
|
12
12
|
} from "./chunk-WK5YTINL.js";
|
|
@@ -91,4 +91,4 @@ export {
|
|
|
91
91
|
writeMigrationFile,
|
|
92
92
|
generateTimestamp
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-HMTFOYDT.js.map
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
rolesNamedBy,
|
|
19
19
|
sqlSkeleton,
|
|
20
20
|
statementSubject
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FXBTUJON.js";
|
|
22
22
|
import {
|
|
23
23
|
isCommentOnly,
|
|
24
24
|
isPsqlMetaCommand,
|
|
@@ -900,4 +900,4 @@ export {
|
|
|
900
900
|
previewMigrationRestore,
|
|
901
901
|
summarizeStatement
|
|
902
902
|
};
|
|
903
|
-
//# sourceMappingURL=chunk-
|
|
903
|
+
//# sourceMappingURL=chunk-IHGINEPX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
comparedSchemas,
|
|
3
3
|
fingerprint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FXBTUJON.js";
|
|
5
5
|
|
|
6
6
|
// src/written-against.ts
|
|
7
7
|
import { createHash } from "crypto";
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
writtenAgainstLine,
|
|
25
25
|
writtenAgainst
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-UC2Z5ISB.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CHECK_META,
|
|
3
3
|
isComparisonCheck
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FXBTUJON.js";
|
|
5
5
|
import {
|
|
6
6
|
CHECK_LINE_PADDING,
|
|
7
7
|
bold,
|
|
@@ -241,4 +241,4 @@ export {
|
|
|
241
241
|
renderDetailed,
|
|
242
242
|
formatSkips
|
|
243
243
|
};
|
|
244
|
-
//# sourceMappingURL=chunk-
|
|
244
|
+
//# sourceMappingURL=chunk-WZALUV4T.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CHECK_NAMES,
|
|
3
|
+
ExtensionsCheck,
|
|
3
4
|
RolesCheck,
|
|
4
5
|
applyTableFilter,
|
|
5
6
|
comparedSchemas,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
sqlSkeleton,
|
|
19
20
|
sqlToIssues,
|
|
20
21
|
withoutAbsentRoles
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-FXBTUJON.js";
|
|
22
23
|
import {
|
|
23
24
|
splitSqlStatements
|
|
24
25
|
} from "./chunk-WK5YTINL.js";
|
|
@@ -2124,127 +2125,6 @@ ${diffs.join("\n")}`,
|
|
|
2124
2125
|
return issues;
|
|
2125
2126
|
}
|
|
2126
2127
|
|
|
2127
|
-
// src/checks/extensions.ts
|
|
2128
|
-
var ExtensionsCheck = class extends Check {
|
|
2129
|
-
constructor(queryFn = pgQuery) {
|
|
2130
|
-
super();
|
|
2131
|
-
this.queryFn = queryFn;
|
|
2132
|
-
}
|
|
2133
|
-
queryFn;
|
|
2134
|
-
name = "extensions";
|
|
2135
|
-
async scan(ctx) {
|
|
2136
|
-
const [source, target, reachable] = await Promise.all([
|
|
2137
|
-
this.fetchExtensions(ctx.source.dbUrl),
|
|
2138
|
-
this.fetchExtensions(ctx.target.dbUrl),
|
|
2139
|
-
this.fetchUpdates(ctx.target.dbUrl)
|
|
2140
|
-
]);
|
|
2141
|
-
const ignored = new Set(ctx.config.ignoreExtensions ?? []);
|
|
2142
|
-
return diffExtensions(source, target.filter((e) => !ignored.has(e.name) || source.some((s) => s.name === e.name)), reachable);
|
|
2143
|
-
}
|
|
2144
|
-
/** The versions each installed extension can be updated to on this server. */
|
|
2145
|
-
async fetchUpdates(dbUrl) {
|
|
2146
|
-
try {
|
|
2147
|
-
const rows = await this.queryFn(dbUrl, UPDATES_SQL);
|
|
2148
|
-
const out = /* @__PURE__ */ new Map();
|
|
2149
|
-
for (const r of rows) out.set(r.name, (out.get(r.name) ?? /* @__PURE__ */ new Set()).add(r.version));
|
|
2150
|
-
return out;
|
|
2151
|
-
} catch {
|
|
2152
|
-
return void 0;
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
async fetchExtensions(dbUrl) {
|
|
2156
|
-
return await this.queryFn(dbUrl, EXTENSIONS_SQL);
|
|
2157
|
-
}
|
|
2158
|
-
};
|
|
2159
|
-
var EXTENSIONS_SQL = `
|
|
2160
|
-
SELECT e.extname AS name,
|
|
2161
|
-
e.extversion AS version,
|
|
2162
|
-
n.nspname AS schema
|
|
2163
|
-
FROM pg_extension e
|
|
2164
|
-
JOIN pg_namespace n ON n.oid = e.extnamespace
|
|
2165
|
-
ORDER BY e.extname
|
|
2166
|
-
`;
|
|
2167
|
-
var UPDATES_SQL = `
|
|
2168
|
-
SELECT e.extname AS name, p.target AS version
|
|
2169
|
-
FROM pg_extension e
|
|
2170
|
-
CROSS JOIN LATERAL pg_extension_update_paths(e.extname) p
|
|
2171
|
-
WHERE p.source = e.extversion AND p.path IS NOT NULL
|
|
2172
|
-
`;
|
|
2173
|
-
var SUPABASE_PLATFORM_EXTENSIONS = [
|
|
2174
|
-
{ name: "pg_graphql", schemas: ["graphql"] },
|
|
2175
|
-
{ name: "supabase_vault", schemas: ["vault"] },
|
|
2176
|
-
{ name: "pgsodium", schemas: ["pgsodium"] },
|
|
2177
|
-
{ name: "pg_stat_statements", schemas: ["extensions"] },
|
|
2178
|
-
{ name: "pgcrypto", schemas: ["extensions"] },
|
|
2179
|
-
{ name: "pgjwt", schemas: ["extensions"] },
|
|
2180
|
-
{ name: "uuid-ossp", schemas: ["extensions"] }
|
|
2181
|
-
];
|
|
2182
|
-
function isPlatformExtension(ext) {
|
|
2183
|
-
return SUPABASE_PLATFORM_EXTENSIONS.some((p) => p.name === ext.name && p.schemas.includes(ext.schema));
|
|
2184
|
-
}
|
|
2185
|
-
function diffExtensions(source, target, reachable) {
|
|
2186
|
-
const issues = [];
|
|
2187
|
-
const sourceMap = new Map(source.map((e) => [e.name, e]));
|
|
2188
|
-
const targetMap = new Map(target.map((e) => [e.name, e]));
|
|
2189
|
-
for (const [name, ext] of sourceMap) {
|
|
2190
|
-
if (!targetMap.has(name)) {
|
|
2191
|
-
issues.push({
|
|
2192
|
-
id: `ext-missing-${name}`,
|
|
2193
|
-
check: "extensions",
|
|
2194
|
-
severity: "warning",
|
|
2195
|
-
title: `Missing extension: ${name}`,
|
|
2196
|
-
description: `Extension "${name}" (v${ext.version}) is enabled in source (schema: ${ext.schema}) but not in target.`,
|
|
2197
|
-
sourceValue: ext,
|
|
2198
|
-
sql: {
|
|
2199
|
-
// Into the schema it is in on the source, which plain PostgreSQL
|
|
2200
|
-
// may not have — Supabase's `extensions`. Made first; if the server
|
|
2201
|
-
// does not ship the extension, the fix is left out with it. A
|
|
2202
|
-
// system schema (pg_cron's pg_catalog) is always there, and cannot
|
|
2203
|
-
// be made.
|
|
2204
|
-
up: ext.schema === "public" ? `CREATE EXTENSION IF NOT EXISTS ${quoteName(name)};` : `${ext.schema.startsWith("pg_") ? "" : `CREATE SCHEMA IF NOT EXISTS ${quoteName(ext.schema)};
|
|
2205
|
-
`}CREATE EXTENSION IF NOT EXISTS ${quoteName(name)} SCHEMA ${quoteName(ext.schema)};`,
|
|
2206
|
-
down: `DROP EXTENSION IF EXISTS ${quoteName(name)};`
|
|
2207
|
-
}
|
|
2208
|
-
});
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
for (const [name, ext] of targetMap) {
|
|
2212
|
-
if (!sourceMap.has(name) && !isPlatformExtension(ext)) {
|
|
2213
|
-
issues.push({
|
|
2214
|
-
id: `ext-extra-${name}`,
|
|
2215
|
-
check: "extensions",
|
|
2216
|
-
severity: "info",
|
|
2217
|
-
title: `Extra extension: ${name}`,
|
|
2218
|
-
description: `Extension "${name}" (v${ext.version}) is enabled in target (schema: ${ext.schema}) but not in source.`,
|
|
2219
|
-
targetValue: ext
|
|
2220
|
-
});
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
for (const [name, srcExt] of sourceMap) {
|
|
2224
|
-
const tgtExt = targetMap.get(name);
|
|
2225
|
-
if (!tgtExt) continue;
|
|
2226
|
-
if (srcExt.version !== tgtExt.version) {
|
|
2227
|
-
const updatable = !reachable || reachable.get(name)?.has(srcExt.version);
|
|
2228
|
-
issues.push({
|
|
2229
|
-
id: `ext-version-${name}`,
|
|
2230
|
-
check: "extensions",
|
|
2231
|
-
severity: "info",
|
|
2232
|
-
title: `Extension version mismatch: ${name}`,
|
|
2233
|
-
description: `Extension "${name}" is v${srcExt.version} in source but v${tgtExt.version} in target.`,
|
|
2234
|
-
sourceValue: srcExt,
|
|
2235
|
-
targetValue: tgtExt,
|
|
2236
|
-
...updatable ? {
|
|
2237
|
-
sql: {
|
|
2238
|
-
up: `ALTER EXTENSION ${quoteName(name)} UPDATE TO ${quoteLiteral(srcExt.version)};`,
|
|
2239
|
-
down: `ALTER EXTENSION ${quoteName(name)} UPDATE TO ${quoteLiteral(tgtExt.version)};`
|
|
2240
|
-
}
|
|
2241
|
-
} : { manualOnly: `the target cannot go from v${tgtExt.version} to v${srcExt.version}: its server has no update path there (an extension cannot be moved down a version)` }
|
|
2242
|
-
});
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
return issues;
|
|
2246
|
-
}
|
|
2247
|
-
|
|
2248
2128
|
// src/checks/queues.ts
|
|
2249
2129
|
var QueuesCheck = class extends Check {
|
|
2250
2130
|
constructor(queryFn = pgQuery) {
|
|
@@ -2537,4 +2417,4 @@ export {
|
|
|
2537
2417
|
createDefaultRegistry,
|
|
2538
2418
|
proveBeforeApply
|
|
2539
2419
|
};
|
|
2540
|
-
//# sourceMappingURL=chunk-
|
|
2420
|
+
//# sourceMappingURL=chunk-ZJPJTC6R.js.map
|
package/dist/commands/diff.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Diff,
|
|
3
3
|
inertApplyFlags,
|
|
4
4
|
rollbackHint
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-DLTCJNJI.js";
|
|
6
6
|
import "../chunk-Q43MN6NE.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-WZALUV4T.js";
|
|
8
|
+
import "../chunk-ZJPJTC6R.js";
|
|
9
|
+
import "../chunk-FXBTUJON.js";
|
|
10
10
|
import "../chunk-WK5YTINL.js";
|
|
11
11
|
import "../chunk-RQCXGO37.js";
|
|
12
12
|
import "../chunk-CKH6J7DI.js";
|
package/dist/commands/hukam.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Diff
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-DLTCJNJI.js";
|
|
4
4
|
import "../chunk-Q43MN6NE.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-WZALUV4T.js";
|
|
6
|
+
import "../chunk-ZJPJTC6R.js";
|
|
7
|
+
import "../chunk-FXBTUJON.js";
|
|
8
8
|
import "../chunk-WK5YTINL.js";
|
|
9
9
|
import "../chunk-RQCXGO37.js";
|
|
10
10
|
import "../chunk-CKH6J7DI.js";
|
package/dist/commands/mcp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-HHM37KPD.js";
|
|
4
|
+
import "../chunk-HMTFOYDT.js";
|
|
5
|
+
import "../chunk-UC2Z5ISB.js";
|
|
6
|
+
import "../chunk-ZJPJTC6R.js";
|
|
7
|
+
import "../chunk-FXBTUJON.js";
|
|
8
8
|
import "../chunk-WK5YTINL.js";
|
|
9
9
|
import "../chunk-ZLNP3DUB.js";
|
|
10
10
|
import "../chunk-USIOUMYL.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
truncateSql
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-DTTQWSSU.js";
|
|
4
4
|
import {
|
|
5
5
|
generateTimestamp,
|
|
6
6
|
writeMigrationFile
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-HMTFOYDT.js";
|
|
8
|
+
import "../../chunk-UC2Z5ISB.js";
|
|
9
9
|
import "../../chunk-HWRRFF55.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-FXBTUJON.js";
|
|
11
11
|
import "../../chunk-WK5YTINL.js";
|
|
12
12
|
import {
|
|
13
13
|
BaseCommand
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
MigrateRun,
|
|
3
3
|
findDestructiveStatements,
|
|
4
4
|
truncateSql
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-DTTQWSSU.js";
|
|
6
|
+
import "../../chunk-UC2Z5ISB.js";
|
|
7
7
|
import "../../chunk-HWRRFF55.js";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-FXBTUJON.js";
|
|
9
9
|
import "../../chunk-WK5YTINL.js";
|
|
10
10
|
import "../../chunk-CKH6J7DI.js";
|
|
11
11
|
import "../../chunk-USIOUMYL.js";
|
package/dist/commands/restore.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
restoreFromMigrations,
|
|
6
6
|
restoreFromSnapshot,
|
|
7
7
|
summarizeStatement
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-IHGINEPX.js";
|
|
9
9
|
import "../chunk-KPU6G6BO.js";
|
|
10
10
|
import "../chunk-HWRRFF55.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-FXBTUJON.js";
|
|
12
12
|
import "../chunk-WK5YTINL.js";
|
|
13
13
|
import {
|
|
14
14
|
renderTip
|
package/dist/commands/sync.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Diff
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-DLTCJNJI.js";
|
|
4
4
|
import "../chunk-Q43MN6NE.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-WZALUV4T.js";
|
|
6
|
+
import "../chunk-ZJPJTC6R.js";
|
|
7
|
+
import "../chunk-FXBTUJON.js";
|
|
8
8
|
import "../chunk-WK5YTINL.js";
|
|
9
9
|
import "../chunk-RQCXGO37.js";
|
|
10
10
|
import "../chunk-CKH6J7DI.js";
|
package/dist/index.js
CHANGED
|
@@ -3,37 +3,37 @@ import {
|
|
|
3
3
|
createServer,
|
|
4
4
|
getLastScanResult,
|
|
5
5
|
setLastScanResult
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HHM37KPD.js";
|
|
7
7
|
import {
|
|
8
8
|
previewMigrationRestore,
|
|
9
9
|
previewSnapshotRestore,
|
|
10
10
|
restoreFromMigrations,
|
|
11
11
|
restoreFromSnapshot
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IHGINEPX.js";
|
|
13
13
|
import {
|
|
14
14
|
backup,
|
|
15
15
|
listMigrationFiles,
|
|
16
16
|
loadMigrations
|
|
17
17
|
} from "./chunk-KPU6G6BO.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-HMTFOYDT.js";
|
|
19
|
+
import "./chunk-UC2Z5ISB.js";
|
|
20
20
|
import "./chunk-HWRRFF55.js";
|
|
21
21
|
import {
|
|
22
22
|
renderDetailed,
|
|
23
23
|
renderSummary
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WZALUV4T.js";
|
|
25
25
|
import {
|
|
26
26
|
CheckRegistry,
|
|
27
27
|
computeScore,
|
|
28
28
|
createDefaultRegistry,
|
|
29
29
|
scan,
|
|
30
30
|
summarize
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZJPJTC6R.js";
|
|
32
32
|
import {
|
|
33
33
|
CHECK_META,
|
|
34
34
|
CHECK_NAMES,
|
|
35
35
|
promote
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-FXBTUJON.js";
|
|
37
37
|
import "./chunk-WK5YTINL.js";
|
|
38
38
|
import {
|
|
39
39
|
BRANCH_DB_PREFIX,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akal/supaforge",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"mcpName": "io.github.akalsoftware/supaforge",
|
|
5
5
|
"description": "Diff and sync your Supabase environments",
|
|
6
6
|
"author": "Akal Software Ltd",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@akal/pg-conformance": "~0.0.19",
|
|
59
|
-
"@dbdiff/cli": "3.0.0-rc.
|
|
59
|
+
"@dbdiff/cli": "3.0.0-rc.36",
|
|
60
60
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
61
61
|
"@oclif/core": "^5.1.12",
|
|
62
62
|
"@supabase/supabase-js": "^2.103.0",
|