@intentius/sql-yodeler 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/README.md +112 -2
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +29 -0
- package/dist/bin.js.map +1 -0
- package/dist/chant/apply.d.ts +59 -0
- package/dist/chant/apply.js +116 -0
- package/dist/chant/apply.js.map +1 -0
- package/dist/chant/build.d.ts +34 -0
- package/dist/chant/build.js +48 -0
- package/dist/chant/build.js.map +1 -0
- package/dist/chant/drift.d.ts +112 -0
- package/dist/chant/drift.js +238 -0
- package/dist/chant/drift.js.map +1 -0
- package/dist/chant/plan.d.ts +45 -0
- package/dist/chant/plan.js +61 -0
- package/dist/chant/plan.js.map +1 -0
- package/dist/chant/process.d.ts +41 -0
- package/dist/chant/process.js +87 -0
- package/dist/chant/process.js.map +1 -0
- package/dist/chant/runnable.d.ts +19 -0
- package/dist/chant/runnable.js +47 -0
- package/dist/chant/runnable.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +99 -0
- package/dist/cli.js.map +1 -0
- package/dist/command.d.ts +23 -0
- package/dist/command.js +13 -0
- package/dist/command.js.map +1 -0
- package/dist/commands/apply.d.ts +3 -0
- package/dist/commands/apply.js +426 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/approve.d.ts +5 -0
- package/dist/commands/approve.js +111 -0
- package/dist/commands/approve.js.map +1 -0
- package/dist/commands/drift.d.ts +14 -0
- package/dist/commands/drift.js +267 -0
- package/dist/commands/drift.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.js +28 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.js +139 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +3 -0
- package/dist/commands/lint.js +202 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/mcp.d.ts +3 -0
- package/dist/commands/mcp.js +50 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/new.d.ts +5 -0
- package/dist/commands/new.js +292 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/override.d.ts +3 -0
- package/dist/commands/override.js +118 -0
- package/dist/commands/override.js.map +1 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.js +183 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/rebase.d.ts +3 -0
- package/dist/commands/rebase.js +167 -0
- package/dist/commands/rebase.js.map +1 -0
- package/dist/commands/repair.d.ts +14 -0
- package/dist/commands/repair.js +125 -0
- package/dist/commands/repair.js.map +1 -0
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.js +54 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/config/define.d.ts +148 -0
- package/dist/config/define.js +20 -0
- package/dist/config/define.js.map +1 -0
- package/dist/config/index.d.ts +11 -0
- package/dist/config/index.js +12 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load.d.ts +17 -0
- package/dist/config/load.js +162 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/settings.d.ts +53 -0
- package/dist/config/settings.js +116 -0
- package/dist/config/settings.js.map +1 -0
- package/dist/env-args.d.ts +24 -0
- package/dist/env-args.js +92 -0
- package/dist/env-args.js.map +1 -0
- package/dist/exit.d.ts +20 -0
- package/dist/exit.js +28 -0
- package/dist/exit.js.map +1 -0
- package/dist/history/client.d.ts +25 -0
- package/dist/history/client.js +42 -0
- package/dist/history/client.js.map +1 -0
- package/dist/history/ddl.d.ts +58 -0
- package/dist/history/ddl.js +100 -0
- package/dist/history/ddl.js.map +1 -0
- package/dist/history/index.d.ts +25 -0
- package/dist/history/index.js +26 -0
- package/dist/history/index.js.map +1 -0
- package/dist/history/lock.d.ts +104 -0
- package/dist/history/lock.js +230 -0
- package/dist/history/lock.js.map +1 -0
- package/dist/history/postgres/ddl.d.ts +22 -0
- package/dist/history/postgres/ddl.js +47 -0
- package/dist/history/postgres/ddl.js.map +1 -0
- package/dist/history/postgres/index.d.ts +12 -0
- package/dist/history/postgres/index.js +13 -0
- package/dist/history/postgres/index.js.map +1 -0
- package/dist/history/postgres/lock.d.ts +48 -0
- package/dist/history/postgres/lock.js +95 -0
- package/dist/history/postgres/lock.js.map +1 -0
- package/dist/history/postgres/store.d.ts +39 -0
- package/dist/history/postgres/store.js +68 -0
- package/dist/history/postgres/store.js.map +1 -0
- package/dist/history/rows.d.ts +96 -0
- package/dist/history/rows.js +73 -0
- package/dist/history/rows.js.map +1 -0
- package/dist/history/store.d.ts +72 -0
- package/dist/history/store.js +134 -0
- package/dist/history/store.js.map +1 -0
- package/dist/history/topology.d.ts +41 -0
- package/dist/history/topology.js +54 -0
- package/dist/history/topology.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/init/adopt.d.ts +70 -0
- package/dist/init/adopt.js +143 -0
- package/dist/init/adopt.js.map +1 -0
- package/dist/init/baseline.d.ts +61 -0
- package/dist/init/baseline.js +88 -0
- package/dist/init/baseline.js.map +1 -0
- package/dist/init/files.d.ts +23 -0
- package/dist/init/files.js +77 -0
- package/dist/init/files.js.map +1 -0
- package/dist/init/index.d.ts +16 -0
- package/dist/init/index.js +17 -0
- package/dist/init/index.js.map +1 -0
- package/dist/init/live.d.ts +39 -0
- package/dist/init/live.js +68 -0
- package/dist/init/live.js.map +1 -0
- package/dist/lint/check.d.ts +88 -0
- package/dist/lint/check.js +227 -0
- package/dist/lint/check.js.map +1 -0
- package/dist/lint/config.d.ts +21 -0
- package/dist/lint/config.js +43 -0
- package/dist/lint/config.js.map +1 -0
- package/dist/lint/index.d.ts +31 -0
- package/dist/lint/index.js +43 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/lint/project-rules.d.ts +19 -0
- package/dist/lint/project-rules.js +32 -0
- package/dist/lint/project-rules.js.map +1 -0
- package/dist/lint/report.d.ts +7 -0
- package/dist/lint/report.js +48 -0
- package/dist/lint/report.js.map +1 -0
- package/dist/lint/rules.d.ts +53 -0
- package/dist/lint/rules.js +42 -0
- package/dist/lint/rules.js.map +1 -0
- package/dist/lint/silences.d.ts +49 -0
- package/dist/lint/silences.js +91 -0
- package/dist/lint/silences.js.map +1 -0
- package/dist/lint/statements.d.ts +38 -0
- package/dist/lint/statements.js +120 -0
- package/dist/lint/statements.js.map +1 -0
- package/dist/mcp/server.d.ts +40 -0
- package/dist/mcp/server.js +106 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +72 -0
- package/dist/mcp/tools.js +178 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/migrations/checks.d.ts +28 -0
- package/dist/migrations/checks.js +97 -0
- package/dist/migrations/checks.js.map +1 -0
- package/dist/migrations/checksum.d.ts +56 -0
- package/dist/migrations/checksum.js +72 -0
- package/dist/migrations/checksum.js.map +1 -0
- package/dist/migrations/create.d.ts +75 -0
- package/dist/migrations/create.js +120 -0
- package/dist/migrations/create.js.map +1 -0
- package/dist/migrations/directory.d.ts +119 -0
- package/dist/migrations/directory.js +229 -0
- package/dist/migrations/directory.js.map +1 -0
- package/dist/migrations/document.d.ts +106 -0
- package/dist/migrations/document.js +83 -0
- package/dist/migrations/document.js.map +1 -0
- package/dist/migrations/index.d.ts +21 -0
- package/dist/migrations/index.js +22 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/pr/comment.d.ts +32 -0
- package/dist/pr/comment.js +99 -0
- package/dist/pr/comment.js.map +1 -0
- package/dist/pr/forge.d.ts +54 -0
- package/dist/pr/forge.js +119 -0
- package/dist/pr/forge.js.map +1 -0
- package/dist/pr/issue.d.ts +68 -0
- package/dist/pr/issue.js +107 -0
- package/dist/pr/issue.js.map +1 -0
- package/dist/pr/model.d.ts +99 -0
- package/dist/pr/model.js +137 -0
- package/dist/pr/model.js.map +1 -0
- package/dist/pr/render.d.ts +29 -0
- package/dist/pr/render.js +279 -0
- package/dist/pr/render.js.map +1 -0
- package/dist/project.d.ts +62 -0
- package/dist/project.js +92 -0
- package/dist/project.js.map +1 -0
- package/dist/rebase/index.d.ts +121 -0
- package/dist/rebase/index.js +390 -0
- package/dist/rebase/index.js.map +1 -0
- package/dist/rebase/repair.d.ts +41 -0
- package/dist/rebase/repair.js +68 -0
- package/dist/rebase/repair.js.map +1 -0
- package/dist/replay/clickhouse.d.ts +33 -0
- package/dist/replay/clickhouse.js +106 -0
- package/dist/replay/clickhouse.js.map +1 -0
- package/dist/replay/index.d.ts +39 -0
- package/dist/replay/index.js +57 -0
- package/dist/replay/index.js.map +1 -0
- package/dist/replay/postgres.d.ts +31 -0
- package/dist/replay/postgres.js +140 -0
- package/dist/replay/postgres.js.map +1 -0
- package/dist/replay/replay.d.ts +114 -0
- package/dist/replay/replay.js +98 -0
- package/dist/replay/replay.js.map +1 -0
- package/dist/replay/report.d.ts +18 -0
- package/dist/replay/report.js +72 -0
- package/dist/replay/report.js.map +1 -0
- package/dist/replay/shared.d.ts +28 -0
- package/dist/replay/shared.js +77 -0
- package/dist/replay/shared.js.map +1 -0
- package/dist/schemas.d.ts +34 -0
- package/dist/schemas.js +38 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +40 -0
- package/dist/server.js +87 -0
- package/dist/server.js.map +1 -0
- package/dist/steps/backfill.d.ts +132 -0
- package/dist/steps/backfill.js +307 -0
- package/dist/steps/backfill.js.map +1 -0
- package/dist/steps/index.d.ts +52 -0
- package/dist/steps/index.js +52 -0
- package/dist/steps/index.js.map +1 -0
- package/dist/steps/kinds.d.ts +101 -0
- package/dist/steps/kinds.js +143 -0
- package/dist/steps/kinds.js.map +1 -0
- package/dist/steps/postgres-migration.d.ts +95 -0
- package/dist/steps/postgres-migration.js +149 -0
- package/dist/steps/postgres-migration.js.map +1 -0
- package/dist/steps/rebuild.d.ts +97 -0
- package/dist/steps/rebuild.js +155 -0
- package/dist/steps/rebuild.js.map +1 -0
- package/dist/steps/run.d.ts +45 -0
- package/dist/steps/run.js +72 -0
- package/dist/steps/run.js.map +1 -0
- package/dist/topology/render.d.ts +17 -0
- package/dist/topology/render.js +17 -0
- package/dist/topology/render.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +11 -0
- package/dist/version.js.map +1 -0
- package/dist/versioned/approval.d.ts +35 -0
- package/dist/versioned/approval.js +53 -0
- package/dist/versioned/approval.js.map +1 -0
- package/dist/versioned/checks.d.ts +29 -0
- package/dist/versioned/checks.js +54 -0
- package/dist/versioned/checks.js.map +1 -0
- package/dist/versioned/clickhouse.d.ts +24 -0
- package/dist/versioned/clickhouse.js +42 -0
- package/dist/versioned/clickhouse.js.map +1 -0
- package/dist/versioned/digest.d.ts +77 -0
- package/dist/versioned/digest.js +69 -0
- package/dist/versioned/digest.js.map +1 -0
- package/dist/versioned/driver.d.ts +51 -0
- package/dist/versioned/driver.js +13 -0
- package/dist/versioned/driver.js.map +1 -0
- package/dist/versioned/engine.d.ts +206 -0
- package/dist/versioned/engine.js +370 -0
- package/dist/versioned/engine.js.map +1 -0
- package/dist/versioned/explain.d.ts +123 -0
- package/dist/versioned/explain.js +294 -0
- package/dist/versioned/explain.js.map +1 -0
- package/dist/versioned/index.d.ts +46 -0
- package/dist/versioned/index.js +77 -0
- package/dist/versioned/index.js.map +1 -0
- package/dist/versioned/op.d.ts +72 -0
- package/dist/versioned/op.js +185 -0
- package/dist/versioned/op.js.map +1 -0
- package/dist/versioned/policy.d.ts +67 -0
- package/dist/versioned/policy.js +161 -0
- package/dist/versioned/policy.js.map +1 -0
- package/dist/versioned/postgres/catalog.d.ts +33 -0
- package/dist/versioned/postgres/catalog.js +34 -0
- package/dist/versioned/postgres/catalog.js.map +1 -0
- package/dist/versioned/postgres/driver.d.ts +71 -0
- package/dist/versioned/postgres/driver.js +140 -0
- package/dist/versioned/postgres/driver.js.map +1 -0
- package/dist/versioned/postgres/executor.d.ts +104 -0
- package/dist/versioned/postgres/executor.js +172 -0
- package/dist/versioned/postgres/executor.js.map +1 -0
- package/dist/versioned/postgres/index.d.ts +11 -0
- package/dist/versioned/postgres/index.js +12 -0
- package/dist/versioned/postgres/index.js.map +1 -0
- package/dist/versioned/postgres/waits.d.ts +46 -0
- package/dist/versioned/postgres/waits.js +78 -0
- package/dist/versioned/postgres/waits.js.map +1 -0
- package/dist/versioned/report.d.ts +25 -0
- package/dist/versioned/report.js +84 -0
- package/dist/versioned/report.js.map +1 -0
- package/dist/versioned/stand-down.d.ts +30 -0
- package/dist/versioned/stand-down.js +56 -0
- package/dist/versioned/stand-down.js.map +1 -0
- package/dist/versioned/state.d.ts +108 -0
- package/dist/versioned/state.js +153 -0
- package/dist/versioned/state.js.map +1 -0
- package/package.json +61 -4
- package/schemas/apply.schema.json +269 -0
- package/schemas/common.schema.json +213 -0
- package/schemas/drift.schema.json +36 -0
- package/schemas/init.schema.json +31 -0
- package/schemas/lint-rules.schema.json +54 -0
- package/schemas/lint.schema.json +290 -0
- package/schemas/mcp.schema.json +70 -0
- package/schemas/new.schema.json +71 -0
- package/schemas/plan.schema.json +371 -0
- package/schemas/rebase.schema.json +54 -0
- package/schemas/repair.schema.json +20 -0
- package/schemas/status.schema.json +310 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** The versioned status as text and as JSON, for `yodel status` and `yodel apply --plan`. */
|
|
2
|
+
import { describeTopology } from "../history/index.js";
|
|
3
|
+
import { describeStep } from "../steps/index.js";
|
|
4
|
+
import { describeServer } from "../server.js";
|
|
5
|
+
import { outOfOrder, partWay } from "./state.js";
|
|
6
|
+
export function statusJson(r) {
|
|
7
|
+
const { status } = r;
|
|
8
|
+
return {
|
|
9
|
+
environment: r.environment,
|
|
10
|
+
...(r.server ? { server: r.server } : {}),
|
|
11
|
+
...(r.dialect === "postgres"
|
|
12
|
+
? { history: { database: r.location.database } }
|
|
13
|
+
: { history: { database: r.location.database, topology: describeTopology(r.location.topology) }, topology: r.topology ?? describeTopology(r.location.topology) }),
|
|
14
|
+
applied: status.applied.map((a) => ({
|
|
15
|
+
id: a.id,
|
|
16
|
+
checksum: a.checksum,
|
|
17
|
+
appliedBy: a.appliedBy,
|
|
18
|
+
recordedAt: a.recordedAt,
|
|
19
|
+
planDigest: a.planDigest,
|
|
20
|
+
inDirectory: a.index !== undefined,
|
|
21
|
+
...(a.repairs ? { repairs: a.repairs.map((r) => ({ checksum: r.checksum, by: r.by, at: r.at, reason: r.reason })) } : {}),
|
|
22
|
+
})),
|
|
23
|
+
pending: status.pending.map((p) => ({
|
|
24
|
+
id: p.id,
|
|
25
|
+
checksum: p.checksum,
|
|
26
|
+
outOfOrder: p.outOfOrder,
|
|
27
|
+
partWay: p.partWay ?? null,
|
|
28
|
+
opSteps: p.opSteps.map(({ index, step }) => ({ index, kind: step.kind, object: step.object, name: step.name, ...(step.kind === "op" ? { op: step.op } : {}) })),
|
|
29
|
+
refusedSteps: p.refusedSteps.map(({ index, step, reason }) => ({ index, kind: step.kind, object: step.object, name: step.name, ...(step.kind === "op" ? { op: step.op } : {}), reason })),
|
|
30
|
+
})),
|
|
31
|
+
outOfOrder: outOfOrder(status).map((p) => p.id),
|
|
32
|
+
partWay: partWay(status).map((p) => ({ id: p.id, resumeAt: p.partWay?.resumeAt, failedStatement: p.partWay?.failedStatement ?? null })),
|
|
33
|
+
mismatches: status.mismatches,
|
|
34
|
+
...(r.digest ? { planDigest: r.digest } : {}),
|
|
35
|
+
...(r.refusal ? { refusal: r.refusal } : {}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function renderStatus(r) {
|
|
39
|
+
const { status } = r;
|
|
40
|
+
const topology = r.dialect === "postgres" ? "" : `, topology ${r.topology ?? describeTopology(r.location.topology)}`;
|
|
41
|
+
const server = r.server ? `${describeServer(r.server)}, ` : "";
|
|
42
|
+
const lines = [`Migrations in ${r.environment} (${server}history ${r.location.database}.history${topology})`, ""];
|
|
43
|
+
lines.push(status.applied.length === 0 ? "Applied: none" : `Applied (${String(status.applied.length)}):`);
|
|
44
|
+
for (const a of status.applied) {
|
|
45
|
+
lines.push(` ${a.id}${a.index === undefined ? " (not in the directory)" : ""} ${a.recordedAt} by ${a.appliedBy}`);
|
|
46
|
+
for (const r of a.repairs ?? [])
|
|
47
|
+
lines.push(` repaired ${r.at} by ${r.by}: ${r.reason}`);
|
|
48
|
+
}
|
|
49
|
+
lines.push("", status.pending.length === 0 ? "Pending: none" : `Pending (${String(status.pending.length)}):`);
|
|
50
|
+
for (const p of status.pending) {
|
|
51
|
+
const marks = [];
|
|
52
|
+
if (p.outOfOrder)
|
|
53
|
+
marks.push("out of order");
|
|
54
|
+
if (p.partWay) {
|
|
55
|
+
const pw = p.partWay;
|
|
56
|
+
marks.push(pw.status === "failed"
|
|
57
|
+
? `failed part way at statement ${String(pw.failedStatement ?? pw.resumeAt)}; resumes at statement ${String(pw.resumeAt)}`
|
|
58
|
+
: `stopped part way; resumes at statement ${String(pw.resumeAt)}`);
|
|
59
|
+
if (pw.edited)
|
|
60
|
+
marks.push("edited since; the statements that ran are unchanged");
|
|
61
|
+
}
|
|
62
|
+
if (p.opSteps.length > 0)
|
|
63
|
+
marks.push(p.opSteps.map(({ index, step }) => `step ${String(index)}: ${describeStep(step)}`).join(", "));
|
|
64
|
+
if (p.refusedSteps.length > 0)
|
|
65
|
+
marks.push(`${String(p.refusedSteps.length)} step(s) yodel apply does not run`);
|
|
66
|
+
lines.push(` ${p.id}${marks.length > 0 ? ` (${marks.join("; ")})` : ""}`);
|
|
67
|
+
if (p.partWay?.error)
|
|
68
|
+
lines.push(` error: ${p.partWay.error.split("\n")[0] ?? ""}`);
|
|
69
|
+
}
|
|
70
|
+
const late = outOfOrder(status);
|
|
71
|
+
if (late.length > 0)
|
|
72
|
+
lines.push("", `Out of order (${String(late.length)}): ${late.map((p) => p.id).join(", ")}; apply with --allow-out-of-order`);
|
|
73
|
+
if (status.mismatches.length > 0) {
|
|
74
|
+
lines.push("", `Checksum mismatches (${String(status.mismatches.length)}):`);
|
|
75
|
+
for (const m of status.mismatches)
|
|
76
|
+
lines.push(` ${m.message}`);
|
|
77
|
+
}
|
|
78
|
+
if (r.digest)
|
|
79
|
+
lines.push("", `Plan digest: ${r.digest}`);
|
|
80
|
+
if (r.refusal)
|
|
81
|
+
lines.push("", r.refusal.message);
|
|
82
|
+
return `${lines.join("\n")}\n`;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/versioned/report.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAG7F,OAAO,EAAE,gBAAgB,EAAwB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAwB,MAAM,YAAY,CAAC;AAkBvE,MAAM,UAAU,UAAU,CAAC,CAAe;IACxC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IACrB,OAAO;QACL,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,GAAG,CAAC,CAAC,CAAC,OAAO,KAAK,UAAU;YAC1B,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;YAChD,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,IAAI,gBAAgB,CAAC,CAAC,CAAC,Q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I,CAAC,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yodel apply --stand-down` (`YODEL_STAND_DOWN=1`): an apply that a newer
|
|
3
|
+
* commit will make anyway steps aside instead of queueing for the lock.
|
|
4
|
+
*
|
|
5
|
+
* The branch is the one the run is for: `GITHUB_REF_NAME` (GitHub and
|
|
6
|
+
* Forgejo Actions), `CI_COMMIT_BRANCH` (GitLab CI), else the checked-out
|
|
7
|
+
* branch. Its tip is fetched from `origin`; when that tip is a different
|
|
8
|
+
* commit that contains this one, a newer commit is on the branch, and its
|
|
9
|
+
* own apply job applies the same environment, this run included. Anything
|
|
10
|
+
* that cannot be told (no branch, no origin, a fetch that fails, a tip that
|
|
11
|
+
* does not contain this commit, as after a force-push) is not a newer
|
|
12
|
+
* commit: the apply goes ahead.
|
|
13
|
+
*/
|
|
14
|
+
export declare const STAND_DOWN_ENV = "YODEL_STAND_DOWN";
|
|
15
|
+
/** Whether the environment asks for stand-down: `YODEL_STAND_DOWN=1` (or `true`). */
|
|
16
|
+
export declare const standDownFromEnv: (env: NodeJS.ProcessEnv) => boolean;
|
|
17
|
+
/** A newer commit on the run's branch, which will apply the environment itself. */
|
|
18
|
+
export interface NewerCommit {
|
|
19
|
+
branch: string;
|
|
20
|
+
/** This run's commit. */
|
|
21
|
+
head: string;
|
|
22
|
+
/** The branch's tip on origin. */
|
|
23
|
+
tip: string;
|
|
24
|
+
}
|
|
25
|
+
/** The branch a run is for; see the module comment. */
|
|
26
|
+
export declare function runBranch(dir: string, env: NodeJS.ProcessEnv): Promise<string | undefined>;
|
|
27
|
+
/** The newer commit on the run's branch, or `undefined` when there is none or it cannot be told. */
|
|
28
|
+
export declare function newerCommit(dir: string, env?: NodeJS.ProcessEnv): Promise<NewerCommit | undefined>;
|
|
29
|
+
/** What a run that stands down says. */
|
|
30
|
+
export declare const standDownLine: (env: string, n: NewerCommit) => string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yodel apply --stand-down` (`YODEL_STAND_DOWN=1`): an apply that a newer
|
|
3
|
+
* commit will make anyway steps aside instead of queueing for the lock.
|
|
4
|
+
*
|
|
5
|
+
* The branch is the one the run is for: `GITHUB_REF_NAME` (GitHub and
|
|
6
|
+
* Forgejo Actions), `CI_COMMIT_BRANCH` (GitLab CI), else the checked-out
|
|
7
|
+
* branch. Its tip is fetched from `origin`; when that tip is a different
|
|
8
|
+
* commit that contains this one, a newer commit is on the branch, and its
|
|
9
|
+
* own apply job applies the same environment, this run included. Anything
|
|
10
|
+
* that cannot be told (no branch, no origin, a fetch that fails, a tip that
|
|
11
|
+
* does not contain this commit, as after a force-push) is not a newer
|
|
12
|
+
* commit: the apply goes ahead.
|
|
13
|
+
*/
|
|
14
|
+
import { execFile } from "node:child_process";
|
|
15
|
+
import { promisify } from "node:util";
|
|
16
|
+
const exec = promisify(execFile);
|
|
17
|
+
export const STAND_DOWN_ENV = "YODEL_STAND_DOWN";
|
|
18
|
+
/** Whether the environment asks for stand-down: `YODEL_STAND_DOWN=1` (or `true`). */
|
|
19
|
+
export const standDownFromEnv = (env) => env[STAND_DOWN_ENV] === "1" || env[STAND_DOWN_ENV] === "true";
|
|
20
|
+
async function git(dir, args) {
|
|
21
|
+
try {
|
|
22
|
+
const { stdout } = await exec("git", args, { cwd: dir, timeout: 60_000 });
|
|
23
|
+
return stdout.trim();
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** The branch a run is for; see the module comment. */
|
|
30
|
+
export async function runBranch(dir, env) {
|
|
31
|
+
const named = env.GITHUB_REF_NAME || env.CI_COMMIT_BRANCH;
|
|
32
|
+
if (named)
|
|
33
|
+
return named;
|
|
34
|
+
return (await git(dir, ["symbolic-ref", "--quiet", "--short", "HEAD"])) || undefined;
|
|
35
|
+
}
|
|
36
|
+
/** The newer commit on the run's branch, or `undefined` when there is none or it cannot be told. */
|
|
37
|
+
export async function newerCommit(dir, env = process.env) {
|
|
38
|
+
const branch = await runBranch(dir, env);
|
|
39
|
+
if (!branch)
|
|
40
|
+
return undefined;
|
|
41
|
+
const head = await git(dir, ["rev-parse", "HEAD"]);
|
|
42
|
+
if (!head)
|
|
43
|
+
return undefined;
|
|
44
|
+
if ((await git(dir, ["fetch", "--quiet", "--no-tags", "origin", `refs/heads/${branch}`])) === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
const tip = await git(dir, ["rev-parse", "FETCH_HEAD"]);
|
|
47
|
+
if (!tip || tip === head)
|
|
48
|
+
return undefined;
|
|
49
|
+
// A tip that contains this commit is newer; one that does not (a force-push, another line) is not.
|
|
50
|
+
if ((await git(dir, ["merge-base", "--is-ancestor", head, tip])) === undefined)
|
|
51
|
+
return undefined;
|
|
52
|
+
return { branch, head, tip };
|
|
53
|
+
}
|
|
54
|
+
/** What a run that stands down says. */
|
|
55
|
+
export const standDownLine = (env, n) => `standing down: ${n.branch} on origin is at ${n.tip.slice(0, 12)}, newer than this run's ${n.head.slice(0, 12)}, and its own apply applies ${env}. Nothing was applied by this run.`;
|
|
56
|
+
//# sourceMappingURL=stand-down.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stand-down.js","sourceRoot":"","sources":["../../src/versioned/stand-down.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,cAAc,GAAG,k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M,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1H,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC3C,mGAAmG;IACnG,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACjG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AAC/B,CAAC;AAED,wCAAwC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,CAAc,EAAU,EAAE,CACnE,kBAAkB,CAAC,CAAC,MAAM,oBAAoB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,+BAA+B,GAAG,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The migrations directory against the history: what is applied, pending,
|
|
3
|
+
* out of order, part way, or changed since it ran. Pure.
|
|
4
|
+
*
|
|
5
|
+
* ## Order, and "out of order"
|
|
6
|
+
*
|
|
7
|
+
* The order is the chain `readMigrations` returns: parent links from the
|
|
8
|
+
* first migration to the newest, never the ids' timestamps. A pending
|
|
9
|
+
* migration is out of order when the chain puts it before a migration the
|
|
10
|
+
* history records applied: it was merged (or rebased into place) after a
|
|
11
|
+
* migration that follows it had already run here. It is reported, refused
|
|
12
|
+
* unless the run passes `--allow-out-of-order`, and never skipped: with the
|
|
13
|
+
* flag it runs, in chain order with the other pending ones.
|
|
14
|
+
*
|
|
15
|
+
* ## Checksums
|
|
16
|
+
*
|
|
17
|
+
* Every applied migration's checksum in the history is compared with its
|
|
18
|
+
* files' checksum, recomputed, on every run; a mismatch refuses (`yodel
|
|
19
|
+
* repair`, #15, records an intended edit). A migration the history records
|
|
20
|
+
* applied that is gone from the directory refuses the same way. A
|
|
21
|
+
* migration that failed part way may be edited before it resumes (to fix
|
|
22
|
+
* the statement that failed), as long as every statement that already
|
|
23
|
+
* succeeded is unchanged: those are compared statement by statement.
|
|
24
|
+
*/
|
|
25
|
+
import type { MigrationStep } from "@intentius/chant-lexicon-sql/migration-statements";
|
|
26
|
+
import { type Migration } from "../migrations/index.js";
|
|
27
|
+
import { type HistoryState, type Repair } from "../history/index.js";
|
|
28
|
+
export interface AppliedMigration {
|
|
29
|
+
id: string;
|
|
30
|
+
checksum: string;
|
|
31
|
+
appliedBy: string;
|
|
32
|
+
/** When it was applied; a later repair does not change it. */
|
|
33
|
+
recordedAt: string;
|
|
34
|
+
planDigest: string;
|
|
35
|
+
/** Its position in the chain; `undefined` when the directory no longer has it. */
|
|
36
|
+
index: number | undefined;
|
|
37
|
+
/** `yodel repair` records since it was applied, oldest first. */
|
|
38
|
+
repairs?: Repair[] | undefined;
|
|
39
|
+
}
|
|
40
|
+
export interface PartWay {
|
|
41
|
+
/** The latest migration row's status: `failed` (a statement failed) or `started` (the runner stopped). */
|
|
42
|
+
status: "failed" | "started";
|
|
43
|
+
/** The index (in `steps`) of the first statement that has not succeeded: where it resumes. */
|
|
44
|
+
resumeAt: number;
|
|
45
|
+
/** The statement that failed, when one did. */
|
|
46
|
+
failedStatement: number | undefined;
|
|
47
|
+
error: string;
|
|
48
|
+
/** The indexes of the statements that succeeded and are never sent again. */
|
|
49
|
+
done: number[];
|
|
50
|
+
/** Its files changed since it ran part way (only statements not yet run). */
|
|
51
|
+
edited: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface PendingMigration {
|
|
54
|
+
id: string;
|
|
55
|
+
/** Its position in the chain. */
|
|
56
|
+
index: number;
|
|
57
|
+
/** The checksum of its files, recomputed. */
|
|
58
|
+
checksum: string;
|
|
59
|
+
/** Before a migration the history records applied. */
|
|
60
|
+
outOfOrder: boolean;
|
|
61
|
+
partWay: PartWay | undefined;
|
|
62
|
+
/** Its Op steps `apply` runs: a ClickHouse rebuild, a backfill (#12). */
|
|
63
|
+
opSteps: Array<{
|
|
64
|
+
index: number;
|
|
65
|
+
step: Exclude<MigrationStep, {
|
|
66
|
+
kind: "statement";
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
69
|
+
/** Its steps `apply` does not run (a manual step, an Op it does not run), each with why. Any of them refuses the run. */
|
|
70
|
+
refusedSteps: Array<{
|
|
71
|
+
index: number;
|
|
72
|
+
step: Exclude<MigrationStep, {
|
|
73
|
+
kind: "statement";
|
|
74
|
+
}>;
|
|
75
|
+
reason: string;
|
|
76
|
+
}>;
|
|
77
|
+
migration: Migration;
|
|
78
|
+
}
|
|
79
|
+
export type Mismatch = {
|
|
80
|
+
kind: "applied";
|
|
81
|
+
id: string;
|
|
82
|
+
recorded: string;
|
|
83
|
+
actual: string;
|
|
84
|
+
message: string;
|
|
85
|
+
} | {
|
|
86
|
+
kind: "part-way";
|
|
87
|
+
id: string;
|
|
88
|
+
statement: number;
|
|
89
|
+
message: string;
|
|
90
|
+
} | {
|
|
91
|
+
kind: "missing";
|
|
92
|
+
id: string;
|
|
93
|
+
recorded: string;
|
|
94
|
+
message: string;
|
|
95
|
+
};
|
|
96
|
+
export interface VersionedStatus {
|
|
97
|
+
/** In chain order; then any the directory no longer has, in the order they were applied. */
|
|
98
|
+
applied: AppliedMigration[];
|
|
99
|
+
/** In chain order. */
|
|
100
|
+
pending: PendingMigration[];
|
|
101
|
+
mismatches: Mismatch[];
|
|
102
|
+
}
|
|
103
|
+
export declare const outOfOrder: (s: VersionedStatus) => PendingMigration[];
|
|
104
|
+
export declare const partWay: (s: VersionedStatus) => PendingMigration[];
|
|
105
|
+
/** A migration's Op steps, split into the ones apply runs and the ones it refuses. A backfill step whose module is not among the migration's files is refused. */
|
|
106
|
+
export declare function classifySteps(m: Migration): Pick<PendingMigration, "opSteps" | "refusedSteps">;
|
|
107
|
+
/** Compares the chain with the history. */
|
|
108
|
+
export declare function compareHistory(ordered: readonly Migration[], state: HistoryState): VersionedStatus;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The migrations directory against the history: what is applied, pending,
|
|
3
|
+
* out of order, part way, or changed since it ran. Pure.
|
|
4
|
+
*
|
|
5
|
+
* ## Order, and "out of order"
|
|
6
|
+
*
|
|
7
|
+
* The order is the chain `readMigrations` returns: parent links from the
|
|
8
|
+
* first migration to the newest, never the ids' timestamps. A pending
|
|
9
|
+
* migration is out of order when the chain puts it before a migration the
|
|
10
|
+
* history records applied: it was merged (or rebased into place) after a
|
|
11
|
+
* migration that follows it had already run here. It is reported, refused
|
|
12
|
+
* unless the run passes `--allow-out-of-order`, and never skipped: with the
|
|
13
|
+
* flag it runs, in chain order with the other pending ones.
|
|
14
|
+
*
|
|
15
|
+
* ## Checksums
|
|
16
|
+
*
|
|
17
|
+
* Every applied migration's checksum in the history is compared with its
|
|
18
|
+
* files' checksum, recomputed, on every run; a mismatch refuses (`yodel
|
|
19
|
+
* repair`, #15, records an intended edit). A migration the history records
|
|
20
|
+
* applied that is gone from the directory refuses the same way. A
|
|
21
|
+
* migration that failed part way may be edited before it resumes (to fix
|
|
22
|
+
* the statement that failed), as long as every statement that already
|
|
23
|
+
* succeeded is unchanged: those are compared statement by statement.
|
|
24
|
+
*/
|
|
25
|
+
import { computeChecksum } from "../migrations/index.js";
|
|
26
|
+
import { isApplied, statementDone } from "../history/index.js";
|
|
27
|
+
import { planStep, stepSha } from "../steps/index.js";
|
|
28
|
+
export const outOfOrder = (s) => s.pending.filter((p) => p.outOfOrder);
|
|
29
|
+
export const partWay = (s) => s.pending.filter((p) => p.partWay !== undefined);
|
|
30
|
+
/** How to record an intended edit of migration `id`. */
|
|
31
|
+
const repair = (id) => `if the edit is intended, record it with yodel repair ${id} --reason ... <env>`;
|
|
32
|
+
function partWayOf(m, rec, actual) {
|
|
33
|
+
const done = [];
|
|
34
|
+
let resumeAt = m.document.steps.length;
|
|
35
|
+
let mismatch;
|
|
36
|
+
m.document.steps.forEach((step, i) => {
|
|
37
|
+
if (statementDone(rec, i)) {
|
|
38
|
+
done.push(i);
|
|
39
|
+
const sha = stepSha(step, m.files);
|
|
40
|
+
if (!mismatch && rec.statements.get(i)?.sha !== sha) {
|
|
41
|
+
mismatch = {
|
|
42
|
+
kind: "part-way",
|
|
43
|
+
id: m.id,
|
|
44
|
+
statement: i,
|
|
45
|
+
message: `${m.id} ran part way, and statement ${String(i)}, which succeeded, has changed in its files since; ${repair(m.id)}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (resumeAt === m.document.steps.length) {
|
|
50
|
+
resumeAt = i;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const failed = [...rec.statements.values()].filter((s) => s.status === "failed").sort((a, b) => b.seq - a.seq)[0];
|
|
54
|
+
return {
|
|
55
|
+
partWay: {
|
|
56
|
+
status: rec.status === "failed" ? "failed" : "started",
|
|
57
|
+
resumeAt,
|
|
58
|
+
failedStatement: failed && !statementDone(rec, failed.index) ? failed.index : undefined,
|
|
59
|
+
error: rec.error || failed?.error || "",
|
|
60
|
+
done,
|
|
61
|
+
edited: rec.checksum !== actual,
|
|
62
|
+
},
|
|
63
|
+
...(mismatch ? { mismatch } : {}),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Why a step apply runs on one dialect is refused in a migration of the other, or `undefined`. */
|
|
67
|
+
function dialectRefusal(run, dialect) {
|
|
68
|
+
if (run === "rebuild" && dialect !== "clickhouse")
|
|
69
|
+
return `a ClickHouseRebuildOp step in a ${dialect} migration`;
|
|
70
|
+
if (run === "pgMigration" && dialect !== "postgres")
|
|
71
|
+
return `a PostgresMigrationOp step in a ${dialect} migration`;
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
/** A migration's Op steps, split into the ones apply runs and the ones it refuses. A backfill step whose module is not among the migration's files is refused. */
|
|
75
|
+
export function classifySteps(m) {
|
|
76
|
+
const opSteps = [];
|
|
77
|
+
const refusedSteps = [];
|
|
78
|
+
m.document.steps.forEach((step, index) => {
|
|
79
|
+
if (step.kind === "statement")
|
|
80
|
+
return;
|
|
81
|
+
const plan = planStep(step);
|
|
82
|
+
const wrongDialect = dialectRefusal(plan.run, m.document.dialect);
|
|
83
|
+
if (plan.run === "refused")
|
|
84
|
+
refusedSteps.push({ index, step, reason: plan.reason });
|
|
85
|
+
else if (wrongDialect)
|
|
86
|
+
refusedSteps.push({ index, step, reason: wrongDialect });
|
|
87
|
+
else if (plan.run === "backfill" && m.files.extra?.[plan.file] === undefined) {
|
|
88
|
+
refusedSteps.push({ index, step, reason: `a backfill step whose module ${plan.file} is not in ${m.id}'s directory` });
|
|
89
|
+
}
|
|
90
|
+
else
|
|
91
|
+
opSteps.push({ index, step });
|
|
92
|
+
});
|
|
93
|
+
return { opSteps, refusedSteps };
|
|
94
|
+
}
|
|
95
|
+
/** Compares the chain with the history. */
|
|
96
|
+
export function compareHistory(ordered, state) {
|
|
97
|
+
const position = new Map(ordered.map((m, i) => [m.id, i]));
|
|
98
|
+
const mismatches = [];
|
|
99
|
+
const applied = [];
|
|
100
|
+
let lastApplied = -1;
|
|
101
|
+
for (const [i, m] of ordered.entries()) {
|
|
102
|
+
const rec = state.byId.get(m.id);
|
|
103
|
+
if (!rec || !isApplied(rec))
|
|
104
|
+
continue;
|
|
105
|
+
lastApplied = i;
|
|
106
|
+
const actual = computeChecksum(m.files);
|
|
107
|
+
applied.push({ id: m.id, checksum: rec.checksum, appliedBy: rec.appliedBy, recordedAt: rec.recordedAt, planDigest: rec.planDigest, index: i, ...(rec.repairs.length > 0 ? { repairs: rec.repairs } : {}) });
|
|
108
|
+
if (rec.checksum !== actual) {
|
|
109
|
+
mismatches.push({
|
|
110
|
+
kind: "applied",
|
|
111
|
+
id: m.id,
|
|
112
|
+
recorded: rec.checksum,
|
|
113
|
+
actual,
|
|
114
|
+
message: `${m.id} was applied with checksum ${rec.checksum}, but its files now hash to ${actual}; ${repair(m.id)}`,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const gone = state.migrations.filter((r) => isApplied(r) && !position.has(r.id)).sort((a, b) => (a.appliedSeq ?? 0) - (b.appliedSeq ?? 0));
|
|
119
|
+
for (const r of gone) {
|
|
120
|
+
applied.push({ id: r.id, checksum: r.checksum, appliedBy: r.appliedBy, recordedAt: r.recordedAt, planDigest: r.planDigest, index: undefined, ...(r.repairs.length > 0 ? { repairs: r.repairs } : {}) });
|
|
121
|
+
mismatches.push({
|
|
122
|
+
kind: "missing",
|
|
123
|
+
id: r.id,
|
|
124
|
+
recorded: r.checksum,
|
|
125
|
+
message: `${r.id} is recorded applied, but the migrations directory no longer has it; restore it, or ${repair(r.id)}`,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
const pending = [];
|
|
129
|
+
for (const [i, m] of ordered.entries()) {
|
|
130
|
+
const rec = state.byId.get(m.id);
|
|
131
|
+
if (isApplied(rec))
|
|
132
|
+
continue;
|
|
133
|
+
const actual = computeChecksum(m.files);
|
|
134
|
+
let pw;
|
|
135
|
+
if (rec) {
|
|
136
|
+
const r = partWayOf(m, rec, actual);
|
|
137
|
+
pw = r.partWay;
|
|
138
|
+
if (r.mismatch)
|
|
139
|
+
mismatches.push(r.mismatch);
|
|
140
|
+
}
|
|
141
|
+
pending.push({
|
|
142
|
+
id: m.id,
|
|
143
|
+
index: i,
|
|
144
|
+
checksum: actual,
|
|
145
|
+
outOfOrder: i < lastApplied,
|
|
146
|
+
partWay: pw,
|
|
147
|
+
...classifySteps(m),
|
|
148
|
+
migration: m,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return { applied, pending, mismatches };
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/versioned/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,eAAe,EAAkB,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAwD,MAAM,qBAAqB,CAAC;AACrH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AA0DtD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAkB,EAAsB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AAC5G,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAkB,EAAsB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;AAEpH,wDAAwD;AACxD,MAAM,MAAM,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,wDAAwD,EAAE,qBAAqB,CAAC;AAE/G,SAAS,SAAS,CAAC,CAAY,EAAE,GAAoB,EAAE,MAAc;IACnE,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;IACvC,IAAI,QAA8B,CAAC;IACnC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACnC,IAAI,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;YAC1B,IAA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,UAAU,EAAE,CAAC,GAAG,WAAW;YAC3B,OAAO,EAAE,EAAE;YACX,GAAG,aAAa,CAAC,CAAC,CAAC;YACnB,SAAS,EAAE,CAAC;SACb,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/sql-yodeler",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Schema management and migrations for ClickHouse and Postgres, on chant's sql lexicon",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/INTENTIUS/sql-yodeler.git"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"yodel": "dist/bin.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"schemas"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.12.0"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.build.json && chmod +x dist/bin.js",
|
|
32
|
+
"prepare": "npm run build",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"check": "npm run typecheck && npm run lint && npm run test",
|
|
37
|
+
"claims": "npm run build && tsx scenarios/run.ts",
|
|
38
|
+
"release": "bash scripts/release.sh",
|
|
39
|
+
"workflows": "tsx .github/src/render.ts",
|
|
40
|
+
"claims:page": "tsx scenarios/status-page.ts",
|
|
41
|
+
"bench": "npm run build && tsx bench/run.ts"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@intentius/chant": "^0.115.0",
|
|
45
|
+
"@intentius/chant-lexicon-sql": "^0.115.0",
|
|
46
|
+
"tsx": "^4.23.15"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/js": "^10.0.1",
|
|
50
|
+
"@intentius/chant-lexicon-docker": "^0.115.0",
|
|
51
|
+
"@intentius/chant-lexicon-forgejo": "^0.115.0",
|
|
52
|
+
"@intentius/chant-lexicon-github": "^0.115.0",
|
|
53
|
+
"@intentius/chant-lexicon-gitlab": "^0.115.0",
|
|
54
|
+
"@types/node": "^22.20.5",
|
|
55
|
+
"@types/pg": "^8.23.1",
|
|
56
|
+
"ajv": "^8.20.0",
|
|
57
|
+
"eslint": "^10.12.0",
|
|
58
|
+
"pg": "^8.23.1",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"typescript-eslint": "^8.71.1",
|
|
61
|
+
"vitest": "^5.0.3"
|
|
62
|
+
}
|
|
63
|
+
}
|