chkit 0.1.0-beta.20 → 0.1.0-beta.22
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 +1 -1
- package/dist/bin/chkit.js +124 -94
- package/dist/bin/chkit.js.map +1 -1
- package/dist/bin/command-dispatch.d.ts +0 -5
- package/dist/bin/command-dispatch.d.ts.map +1 -1
- package/dist/bin/command-dispatch.js +1 -1
- package/dist/bin/command-dispatch.js.map +1 -1
- package/dist/bin/commands/drift.d.ts +2 -1
- package/dist/bin/commands/drift.d.ts.map +1 -1
- package/dist/bin/debug.d.ts +1 -1
- package/dist/bin/debug.d.ts.map +1 -1
- package/dist/bin/debug.js +8 -15
- package/dist/bin/debug.js.map +1 -1
- package/dist/bin/internal-plugins/skill-hint.d.ts +1 -6
- package/dist/bin/internal-plugins/skill-hint.d.ts.map +1 -1
- package/dist/bin/internal-plugins/skill-hint.js +1 -1
- package/dist/bin/internal-plugins/skill-hint.js.map +1 -1
- package/dist/bin/journal-store.d.ts +2 -6
- package/dist/bin/journal-store.d.ts.map +1 -1
- package/dist/bin/journal-store.js +1 -5
- package/dist/bin/journal-store.js.map +1 -1
- package/dist/bin/json-output.d.ts +2 -5
- package/dist/bin/json-output.d.ts.map +1 -1
- package/dist/bin/json-output.js +1 -1
- package/dist/bin/json-output.js.map +1 -1
- package/dist/bin/lib.d.ts +2 -5
- package/dist/bin/lib.d.ts.map +1 -1
- package/dist/bin/lib.js +2 -5
- package/dist/bin/lib.js.map +1 -1
- package/dist/bin/logging.d.ts +3 -0
- package/dist/bin/logging.d.ts.map +1 -0
- package/dist/bin/logging.js +31 -0
- package/dist/bin/logging.js.map +1 -0
- package/dist/bin/migration-store.d.ts +2 -2
- package/dist/bin/migration-store.d.ts.map +1 -1
- package/dist/bin/migration-store.js +1 -1
- package/dist/bin/migration-store.js.map +1 -1
- package/dist/bin/safety-markers.d.ts +1 -3
- package/dist/bin/safety-markers.d.ts.map +1 -1
- package/dist/bin/safety-markers.js +2 -2
- package/dist/bin/safety-markers.js.map +1 -1
- package/dist/bin/table-scope.d.ts +1 -2
- package/dist/bin/table-scope.d.ts.map +1 -1
- package/dist/bin/table-scope.js +1 -1
- package/dist/bin/table-scope.js.map +1 -1
- package/dist/commands/check/command.d.ts +3 -0
- package/dist/commands/check/command.d.ts.map +1 -0
- package/dist/commands/check/command.js +105 -0
- package/dist/commands/check/command.js.map +1 -0
- package/dist/commands/check/output.d.ts +35 -0
- package/dist/commands/check/output.d.ts.map +1 -0
- package/dist/commands/check/output.js +105 -0
- package/dist/commands/check/output.js.map +1 -0
- package/dist/commands/drift/command.d.ts +3 -0
- package/dist/commands/drift/command.d.ts.map +1 -0
- package/dist/commands/drift/command.js +127 -0
- package/dist/commands/drift/command.js.map +1 -0
- package/dist/commands/drift/compare.d.ts +66 -0
- package/dist/commands/drift/compare.d.ts.map +1 -0
- package/dist/commands/drift/compare.js +220 -0
- package/dist/commands/drift/compare.js.map +1 -0
- package/dist/commands/drift/diff.d.ts +8 -0
- package/dist/commands/drift/diff.d.ts.map +1 -0
- package/dist/commands/drift/diff.js +46 -0
- package/dist/commands/drift/diff.js.map +1 -0
- package/dist/commands/drift/payload.d.ts +24 -0
- package/dist/commands/drift/payload.d.ts.map +1 -0
- package/dist/commands/drift/payload.js +96 -0
- package/dist/commands/drift/payload.js.map +1 -0
- package/dist/commands/generate/command.d.ts +3 -0
- package/dist/commands/generate/command.d.ts.map +1 -0
- package/dist/commands/generate/command.js +161 -0
- package/dist/commands/generate/command.js.map +1 -0
- package/dist/commands/generate/output.d.ts +8 -0
- package/dist/commands/generate/output.d.ts.map +1 -0
- package/dist/commands/generate/output.js +59 -0
- package/dist/commands/generate/output.js.map +1 -0
- package/dist/commands/generate/plan-pipeline.d.ts +7 -0
- package/dist/commands/generate/plan-pipeline.d.ts.map +1 -0
- package/dist/commands/generate/plan-pipeline.js +143 -0
- package/dist/commands/generate/plan-pipeline.js.map +1 -0
- package/dist/commands/generate/rename-mappings.d.ts +29 -0
- package/dist/commands/generate/rename-mappings.d.ts.map +1 -0
- package/dist/commands/generate/rename-mappings.js +195 -0
- package/dist/commands/generate/rename-mappings.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +24 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate/apply.d.ts +18 -0
- package/dist/commands/migrate/apply.d.ts.map +1 -0
- package/dist/commands/migrate/apply.js +48 -0
- package/dist/commands/migrate/apply.js.map +1 -0
- package/dist/commands/migrate/command.d.ts +3 -0
- package/dist/commands/migrate/command.d.ts.map +1 -0
- package/dist/commands/migrate/command.js +175 -0
- package/dist/commands/migrate/command.js.map +1 -0
- package/dist/commands/migrate/destructive.d.ts +7 -0
- package/dist/commands/migrate/destructive.d.ts.map +1 -0
- package/dist/commands/migrate/destructive.js +16 -0
- package/dist/commands/migrate/destructive.js.map +1 -0
- package/dist/commands/migrate/prompts.d.ts +6 -0
- package/dist/commands/migrate/prompts.d.ts.map +1 -0
- package/dist/commands/migrate/prompts.js +40 -0
- package/dist/commands/migrate/prompts.js.map +1 -0
- package/dist/commands/migrate/scope.d.ts +2 -0
- package/dist/commands/migrate/scope.d.ts.map +1 -0
- package/dist/commands/migrate/scope.js +25 -0
- package/dist/commands/migrate/scope.js.map +1 -0
- package/dist/commands/plugin.d.ts +3 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +132 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/commands/query.d.ts +8 -0
- package/dist/commands/query.d.ts.map +1 -0
- package/dist/commands/query.js +114 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +63 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/drift.d.ts +7 -6
- package/dist/drift.d.ts.map +1 -1
- package/dist/drift.js +17 -2
- package/dist/drift.js.map +1 -1
- package/dist/internal-plugins/index.d.ts +3 -0
- package/dist/internal-plugins/index.d.ts.map +1 -0
- package/dist/internal-plugins/index.js +5 -0
- package/dist/internal-plugins/index.js.map +1 -0
- package/dist/internal-plugins/skill-hint/agent-detect.d.ts +20 -0
- package/dist/internal-plugins/skill-hint/agent-detect.d.ts.map +1 -0
- package/dist/internal-plugins/skill-hint/agent-detect.js +68 -0
- package/dist/internal-plugins/skill-hint/agent-detect.js.map +1 -0
- package/dist/internal-plugins/skill-hint/plugin.d.ts +16 -0
- package/dist/internal-plugins/skill-hint/plugin.d.ts.map +1 -0
- package/dist/internal-plugins/skill-hint/plugin.js +60 -0
- package/dist/internal-plugins/skill-hint/plugin.js.map +1 -0
- package/dist/internal-plugins/skill-hint/prompt.d.ts +5 -0
- package/dist/internal-plugins/skill-hint/prompt.d.ts.map +1 -0
- package/dist/internal-plugins/skill-hint/prompt.js +37 -0
- package/dist/internal-plugins/skill-hint/prompt.js.map +1 -0
- package/dist/internal-plugins/skill-hint/state.d.ts +7 -0
- package/dist/internal-plugins/skill-hint/state.d.ts.map +1 -0
- package/dist/internal-plugins/skill-hint/state.js +23 -0
- package/dist/internal-plugins/skill-hint/state.js.map +1 -0
- package/dist/plugins.d.ts +42 -2
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/runtime/command-dispatch.d.ts +18 -0
- package/dist/runtime/command-dispatch.d.ts.map +1 -0
- package/dist/runtime/command-dispatch.js +237 -0
- package/dist/runtime/command-dispatch.js.map +1 -0
- package/dist/runtime/command-registry.d.ts +34 -0
- package/dist/runtime/command-registry.d.ts.map +1 -0
- package/dist/runtime/command-registry.js +87 -0
- package/dist/runtime/command-registry.js.map +1 -0
- package/dist/runtime/config.d.ts +13 -0
- package/dist/runtime/config.d.ts.map +1 -0
- package/dist/runtime/config.js +49 -0
- package/dist/runtime/config.js.map +1 -0
- package/dist/runtime/debug.d.ts +3 -0
- package/dist/runtime/debug.d.ts.map +1 -0
- package/dist/runtime/debug.js +14 -0
- package/dist/runtime/debug.js.map +1 -0
- package/dist/runtime/global-flags.d.ts +16 -0
- package/dist/runtime/global-flags.d.ts.map +1 -0
- package/dist/runtime/global-flags.js +7 -0
- package/dist/runtime/global-flags.js.map +1 -0
- package/dist/runtime/help.d.ts +5 -0
- package/dist/runtime/help.d.ts.map +1 -0
- package/dist/runtime/help.js +84 -0
- package/dist/runtime/help.js.map +1 -0
- package/dist/runtime/journal-store.d.ts +10 -0
- package/dist/runtime/journal-store.d.ts.map +1 -0
- package/dist/runtime/journal-store.js +137 -0
- package/dist/runtime/journal-store.js.map +1 -0
- package/dist/runtime/json-output.d.ts +5 -0
- package/dist/runtime/json-output.d.ts.map +1 -0
- package/dist/runtime/json-output.js +21 -0
- package/dist/runtime/json-output.js.map +1 -0
- package/dist/runtime/logging.d.ts +3 -0
- package/dist/runtime/logging.d.ts.map +1 -0
- package/dist/runtime/logging.js +31 -0
- package/dist/runtime/logging.js.map +1 -0
- package/dist/runtime/migration-store.d.ts +22 -0
- package/dist/runtime/migration-store.d.ts.map +1 -0
- package/dist/runtime/migration-store.js +60 -0
- package/dist/runtime/migration-store.js.map +1 -0
- package/dist/runtime/plugin-runtime/errors.d.ts +3 -0
- package/dist/runtime/plugin-runtime/errors.d.ts.map +1 -0
- package/dist/runtime/plugin-runtime/errors.js +13 -0
- package/dist/runtime/plugin-runtime/errors.js.map +1 -0
- package/dist/runtime/plugin-runtime/executor-debug.d.ts +3 -0
- package/dist/runtime/plugin-runtime/executor-debug.d.ts.map +1 -0
- package/dist/runtime/plugin-runtime/executor-debug.js +65 -0
- package/dist/runtime/plugin-runtime/executor-debug.js.map +1 -0
- package/dist/runtime/plugin-runtime/hooks.d.ts +23 -0
- package/dist/runtime/plugin-runtime/hooks.d.ts.map +1 -0
- package/dist/runtime/plugin-runtime/hooks.js +148 -0
- package/dist/runtime/plugin-runtime/hooks.js.map +1 -0
- package/dist/runtime/plugin-runtime/index.d.ts +9 -0
- package/dist/runtime/plugin-runtime/index.d.ts.map +1 -0
- package/dist/runtime/plugin-runtime/index.js +144 -0
- package/dist/runtime/plugin-runtime/index.js.map +1 -0
- package/dist/runtime/plugin-runtime/loader.d.ts +14 -0
- package/dist/runtime/plugin-runtime/loader.d.ts.map +1 -0
- package/dist/runtime/plugin-runtime/loader.js +70 -0
- package/dist/runtime/plugin-runtime/loader.js.map +1 -0
- package/dist/runtime/plugin-runtime/null-executor.d.ts +3 -0
- package/dist/runtime/plugin-runtime/null-executor.d.ts.map +1 -0
- package/dist/runtime/plugin-runtime/null-executor.js +17 -0
- package/dist/runtime/plugin-runtime/null-executor.js.map +1 -0
- package/dist/runtime/safety-markers.d.ts +23 -0
- package/dist/runtime/safety-markers.d.ts.map +1 -0
- package/dist/runtime/safety-markers.js +85 -0
- package/dist/runtime/safety-markers.js.map +1 -0
- package/dist/runtime/schema-loader.d.ts +3 -0
- package/dist/runtime/schema-loader.d.ts.map +1 -0
- package/dist/runtime/schema-loader.js +11 -0
- package/dist/runtime/schema-loader.js.map +1 -0
- package/dist/runtime/table-scope.d.ts +33 -0
- package/dist/runtime/table-scope.d.ts.map +1 -0
- package/dist/runtime/table-scope.js +167 -0
- package/dist/runtime/table-scope.js.map +1 -0
- package/dist/runtime/version.d.ts +2 -0
- package/dist/runtime/version.d.ts.map +1 -0
- package/dist/runtime/version.js +5 -0
- package/dist/runtime/version.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
export function parseRenameTableMappings(values) {
|
|
2
|
+
return values.map((mapping) => {
|
|
3
|
+
const [fromRaw, toRaw, ...rest] = mapping.split('=').map((part) => part.trim());
|
|
4
|
+
if (!fromRaw || !toRaw || rest.length > 0) {
|
|
5
|
+
throw new Error(`Invalid --rename-table mapping "${mapping}". Expected format: old_db.old_table=new_db.new_table`);
|
|
6
|
+
}
|
|
7
|
+
const from = parseQualifiedTable(fromRaw);
|
|
8
|
+
const to = parseQualifiedTable(toRaw);
|
|
9
|
+
return {
|
|
10
|
+
oldDatabase: from.database,
|
|
11
|
+
oldName: from.name,
|
|
12
|
+
newDatabase: to.database,
|
|
13
|
+
newName: to.name,
|
|
14
|
+
source: 'cli',
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export function parseRenameColumnMappings(values) {
|
|
19
|
+
return values.map((mapping) => {
|
|
20
|
+
const [fromRaw, toRaw, ...rest] = mapping.split('=').map((part) => part.trim());
|
|
21
|
+
if (!fromRaw || !toRaw || rest.length > 0) {
|
|
22
|
+
throw new Error(`Invalid --rename-column mapping "${mapping}". Expected format: db.table.old_column=new_column`);
|
|
23
|
+
}
|
|
24
|
+
const parts = fromRaw.split('.').map((part) => part.trim());
|
|
25
|
+
if (parts.length !== 3 || parts.some((part) => part.length === 0)) {
|
|
26
|
+
throw new Error(`Invalid --rename-column source "${fromRaw}". Expected format: db.table.old_column`);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
database: parts[0],
|
|
30
|
+
table: parts[1],
|
|
31
|
+
from: parts[2],
|
|
32
|
+
to: toRaw,
|
|
33
|
+
source: 'cli',
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export function collectSchemaRenameMappings(definitions) {
|
|
38
|
+
const tableMappings = [];
|
|
39
|
+
const columnMappings = [];
|
|
40
|
+
for (const definition of definitions) {
|
|
41
|
+
if (definition.kind !== 'table')
|
|
42
|
+
continue;
|
|
43
|
+
if (definition.renamedFrom) {
|
|
44
|
+
tableMappings.push({
|
|
45
|
+
oldDatabase: definition.renamedFrom.database ?? definition.database,
|
|
46
|
+
oldName: definition.renamedFrom.name,
|
|
47
|
+
newDatabase: definition.database,
|
|
48
|
+
newName: definition.name,
|
|
49
|
+
source: 'schema',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
for (const column of definition.columns) {
|
|
53
|
+
if (!column.renamedFrom)
|
|
54
|
+
continue;
|
|
55
|
+
columnMappings.push({
|
|
56
|
+
database: definition.database,
|
|
57
|
+
table: definition.name,
|
|
58
|
+
from: column.renamedFrom,
|
|
59
|
+
to: column.name,
|
|
60
|
+
source: 'schema',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return { tableMappings, columnMappings };
|
|
65
|
+
}
|
|
66
|
+
export function mergeTableMappings(schemaMappings, cliMappings) {
|
|
67
|
+
const merged = [...schemaMappings];
|
|
68
|
+
for (const cliMapping of cliMappings) {
|
|
69
|
+
const cliOldKey = `${cliMapping.oldDatabase}.${cliMapping.oldName}`;
|
|
70
|
+
const cliNewKey = `${cliMapping.newDatabase}.${cliMapping.newName}`;
|
|
71
|
+
for (let i = merged.length - 1; i >= 0; i -= 1) {
|
|
72
|
+
const entry = merged[i];
|
|
73
|
+
if (!entry)
|
|
74
|
+
continue;
|
|
75
|
+
const oldKey = `${entry.oldDatabase}.${entry.oldName}`;
|
|
76
|
+
const newKey = `${entry.newDatabase}.${entry.newName}`;
|
|
77
|
+
if (oldKey === cliOldKey || newKey === cliNewKey) {
|
|
78
|
+
merged.splice(i, 1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
merged.push(cliMapping);
|
|
82
|
+
}
|
|
83
|
+
return merged;
|
|
84
|
+
}
|
|
85
|
+
export function mergeColumnMappings(schemaMappings, cliMappings) {
|
|
86
|
+
const merged = [...schemaMappings];
|
|
87
|
+
for (const cliMapping of cliMappings) {
|
|
88
|
+
const cliFromKey = `${cliMapping.database}.${cliMapping.table}.${cliMapping.from}`;
|
|
89
|
+
const cliToKey = `${cliMapping.database}.${cliMapping.table}.${cliMapping.to}`;
|
|
90
|
+
for (let i = merged.length - 1; i >= 0; i -= 1) {
|
|
91
|
+
const entry = merged[i];
|
|
92
|
+
if (!entry)
|
|
93
|
+
continue;
|
|
94
|
+
const fromKey = `${entry.database}.${entry.table}.${entry.from}`;
|
|
95
|
+
const toKey = `${entry.database}.${entry.table}.${entry.to}`;
|
|
96
|
+
if (fromKey === cliFromKey || toKey === cliToKey) {
|
|
97
|
+
merged.splice(i, 1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
merged.push(cliMapping);
|
|
101
|
+
}
|
|
102
|
+
return merged;
|
|
103
|
+
}
|
|
104
|
+
export function resolveActiveTableMappings(previousDefinitions, nextDefinitions, mappings) {
|
|
105
|
+
return mappings.filter((mapping) => tableExists(previousDefinitions, mapping.oldDatabase, mapping.oldName) &&
|
|
106
|
+
tableExists(nextDefinitions, mapping.newDatabase, mapping.newName));
|
|
107
|
+
}
|
|
108
|
+
export function assertNoConflictingTableMappings(mappings) {
|
|
109
|
+
const byOld = new Map();
|
|
110
|
+
const byNew = new Map();
|
|
111
|
+
for (const mapping of mappings) {
|
|
112
|
+
const oldKey = `${mapping.oldDatabase}.${mapping.oldName}`;
|
|
113
|
+
const newKey = `${mapping.newDatabase}.${mapping.newName}`;
|
|
114
|
+
const existingOld = byOld.get(oldKey);
|
|
115
|
+
if (existingOld && (existingOld.newDatabase !== mapping.newDatabase || existingOld.newName !== mapping.newName)) {
|
|
116
|
+
throw new Error(`Conflicting table rename source mapping for "${oldKey}".`);
|
|
117
|
+
}
|
|
118
|
+
byOld.set(oldKey, mapping);
|
|
119
|
+
const existingNew = byNew.get(newKey);
|
|
120
|
+
if (existingNew && (existingNew.oldDatabase !== mapping.oldDatabase || existingNew.oldName !== mapping.oldName)) {
|
|
121
|
+
throw new Error(`Conflicting table rename target mapping for "${newKey}".`);
|
|
122
|
+
}
|
|
123
|
+
byNew.set(newKey, mapping);
|
|
124
|
+
}
|
|
125
|
+
for (const key of byOld.keys()) {
|
|
126
|
+
if (byNew.has(key)) {
|
|
127
|
+
throw new Error(`Unsupported chained or cyclic table rename mapping involving "${key}". Use direct one-step mappings only.`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
export function assertNoConflictingColumnMappings(mappings) {
|
|
132
|
+
const byFrom = new Map();
|
|
133
|
+
const byTo = new Map();
|
|
134
|
+
for (const mapping of mappings) {
|
|
135
|
+
const fromKey = `${mapping.database}.${mapping.table}.${mapping.from}`;
|
|
136
|
+
const toKey = `${mapping.database}.${mapping.table}.${mapping.to}`;
|
|
137
|
+
const existingFrom = byFrom.get(fromKey);
|
|
138
|
+
if (existingFrom && existingFrom.to !== mapping.to) {
|
|
139
|
+
throw new Error(`Conflicting column rename source mapping for "${fromKey}".`);
|
|
140
|
+
}
|
|
141
|
+
byFrom.set(fromKey, mapping);
|
|
142
|
+
const existingTo = byTo.get(toKey);
|
|
143
|
+
if (existingTo && existingTo.from !== mapping.from) {
|
|
144
|
+
throw new Error(`Conflicting column rename target mapping for "${toKey}".`);
|
|
145
|
+
}
|
|
146
|
+
byTo.set(toKey, mapping);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export function assertCliTableMappingsResolvable(cliMappings, previousDefinitions, nextDefinitions) {
|
|
150
|
+
for (const mapping of cliMappings) {
|
|
151
|
+
const hasOld = tableExists(previousDefinitions, mapping.oldDatabase, mapping.oldName);
|
|
152
|
+
const hasNew = tableExists(nextDefinitions, mapping.newDatabase, mapping.newName);
|
|
153
|
+
if (hasOld && hasNew)
|
|
154
|
+
continue;
|
|
155
|
+
if (!hasOld && !hasNew) {
|
|
156
|
+
throw new Error(`--rename-table mapping "${mapping.oldDatabase}.${mapping.oldName}=${mapping.newDatabase}.${mapping.newName}" is invalid: source table is missing from previous snapshot and target table is missing from current schema.`);
|
|
157
|
+
}
|
|
158
|
+
if (!hasOld) {
|
|
159
|
+
throw new Error(`--rename-table mapping "${mapping.oldDatabase}.${mapping.oldName}=${mapping.newDatabase}.${mapping.newName}" is invalid: source table is missing from previous snapshot.`);
|
|
160
|
+
}
|
|
161
|
+
throw new Error(`--rename-table mapping "${mapping.oldDatabase}.${mapping.oldName}=${mapping.newDatabase}.${mapping.newName}" is invalid: target table is missing from current schema.`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
export function remapOldDefinitionsForTableRenames(previousDefinitions, mappings) {
|
|
165
|
+
if (mappings.length === 0)
|
|
166
|
+
return previousDefinitions;
|
|
167
|
+
const mappingByOld = new Map();
|
|
168
|
+
for (const mapping of mappings) {
|
|
169
|
+
mappingByOld.set(`${mapping.oldDatabase}.${mapping.oldName}`, mapping);
|
|
170
|
+
}
|
|
171
|
+
return previousDefinitions.map((definition) => {
|
|
172
|
+
if (definition.kind !== 'table')
|
|
173
|
+
return definition;
|
|
174
|
+
const mapping = mappingByOld.get(`${definition.database}.${definition.name}`);
|
|
175
|
+
if (!mapping)
|
|
176
|
+
return definition;
|
|
177
|
+
const remapped = {
|
|
178
|
+
...definition,
|
|
179
|
+
database: mapping.newDatabase,
|
|
180
|
+
name: mapping.newName,
|
|
181
|
+
};
|
|
182
|
+
return remapped;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function parseQualifiedTable(input) {
|
|
186
|
+
const [database, name, ...rest] = input.split('.').map((part) => part.trim());
|
|
187
|
+
if (!database || !name || rest.length > 0) {
|
|
188
|
+
throw new Error(`Invalid table reference "${input}". Expected format: database.table`);
|
|
189
|
+
}
|
|
190
|
+
return { database, name };
|
|
191
|
+
}
|
|
192
|
+
function tableExists(definitions, database, name) {
|
|
193
|
+
return definitions.some((definition) => definition.kind === 'table' && definition.database === database && definition.name === name);
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=rename-mappings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename-mappings.js","sourceRoot":"","sources":["../../../src/commands/generate/rename-mappings.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,wBAAwB,CAAC,MAAgB;IACvD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC5B,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAA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T_CONFIG_FILE, writeIfMissing } from '../runtime/config.js';
|
|
3
|
+
export async function cmdInit() {
|
|
4
|
+
const cwd = process.cwd();
|
|
5
|
+
const configPath = resolve(cwd, DEFAULT_CONFIG_FILE);
|
|
6
|
+
const schemaPath = resolve(cwd, 'src/db/schema/example.ts');
|
|
7
|
+
const wroteConfig = await writeIfMissing(configPath, `import { defineConfig } from '@chkit/core'\n\nexport default defineConfig({\n schema: './src/db/schema/**/*.ts',\n outDir: './chkit',\n migrationsDir: './chkit/migrations',\n metaDir: './chkit/meta',\n plugins: [\n // Typed plugin registration (recommended):\n // import { codegen } from '@chkit/plugin-codegen'\n // codegen({ emitZod: true }),\n\n // Legacy path-based registration (still supported):\n // { resolve: './plugins/example-plugin.ts', options: {}, enabled: true },\n ],\n clickhouse: {\n url: process.env.CLICKHOUSE_URL ?? 'http://localhost:8123',\n username: process.env.CLICKHOUSE_USER ?? 'default',\n password: process.env.CLICKHOUSE_PASSWORD ?? '',\n database: process.env.CLICKHOUSE_DB ?? 'default',\n },\n})\n`);
|
|
8
|
+
const wroteSchema = await writeIfMissing(schemaPath, `import { schema, table } from '@chkit/core'\n\nconst events = table({\n database: 'default',\n name: 'events',\n engine: 'MergeTree',\n columns: [\n { name: 'id', type: 'UInt64' },\n { name: 'source', type: 'String' },\n { name: 'ingested_at', type: 'DateTime64(3)', default: 'fn:now64(3)' },\n ],\n primaryKey: ['id'],\n orderBy: ['id'],\n partitionBy: 'toYYYYMM(ingested_at)',\n})\n\nexport default schema(events)\n`);
|
|
9
|
+
if (wroteConfig)
|
|
10
|
+
console.log(`Created ${relative(cwd, configPath)}`);
|
|
11
|
+
if (wroteSchema)
|
|
12
|
+
console.log(`Created ${relative(cwd, schemaPath)}`);
|
|
13
|
+
if (wroteConfig || wroteSchema) {
|
|
14
|
+
console.log('');
|
|
15
|
+
console.log('Next steps:');
|
|
16
|
+
console.log(' 1. Set CLICKHOUSE_URL (and CLICKHOUSE_USER / CLICKHOUSE_PASSWORD / CLICKHOUSE_DB if needed).');
|
|
17
|
+
console.log(' 2. Edit src/db/schema/example.ts to match your data.');
|
|
18
|
+
console.log(' 3. Run: bunx chkit generate --name init');
|
|
19
|
+
console.log(' 4. Run: bunx chkit migrate --apply');
|
|
20
|
+
console.log('');
|
|
21
|
+
console.log('Docs: https://chkit.obsessiondb.com/getting-started/');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1E,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IACzB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA;IACpD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,0BAA0B,CAAC,CAAA;IAE3D,MAAM,WAAW,GAAG,MAAM,cAAc,CACtC,UAAU,EACV,8vBAA8vB,CAC/vB,CAAA;IAED,MAAM,WAAW,GAAG,MAAM,cAAc,CACtC,UAAU,EACV,obAAob,CACrb,CAAA;IAED,IAAI,WAAW;QAAE,OAAO,CAAC,GAAG,CAAC,WAAW,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC,CAAA;IACpE,IAAI,WAAW;QAAE,OAAO,CAAC,GAAG,CAAC,WAAW,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC,CAAA;IAEpE,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACf,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;QAC1B,OAAO,CAAC,GAAG,CAAC,gGAAgG,CAAC,CAAA;QAC7G,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAA;QACrE,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAA;QACxD,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;QACnD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACf,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAA;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ClickHouseExecutor } from '@chkit/clickhouse';
|
|
2
|
+
import type { ResolvedChxConfig } from '@chkit/core';
|
|
3
|
+
import type { ParsedFlags, PluginRuntime, TableScope } from '../../plugins.js';
|
|
4
|
+
import type { createJournalStore } from '../../runtime/journal-store.js';
|
|
5
|
+
import { type MigrationJournalEntry } from '../../runtime/migration-store.js';
|
|
6
|
+
type JournalStore = ReturnType<typeof createJournalStore>;
|
|
7
|
+
export declare function applyMigration(input: {
|
|
8
|
+
db: ClickHouseExecutor;
|
|
9
|
+
journalStore: JournalStore;
|
|
10
|
+
pluginRuntime: PluginRuntime;
|
|
11
|
+
config: ResolvedChxConfig;
|
|
12
|
+
tableScope: TableScope;
|
|
13
|
+
flags: ParsedFlags;
|
|
14
|
+
migrationsDir: string;
|
|
15
|
+
file: string;
|
|
16
|
+
}): Promise<MigrationJournalEntry>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/commands/migrate/apply.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,EAAe,KAAK,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAM1F,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEzD,wBAAsB,cAAc,CAAC,KAAK,EAAE;IAC1C,EAAE,EAAE,kBAAkB,CAAA;IACtB,YAAY,EAAE,YAAY,CAAA;IAC1B,aAAa,EAAE,aAAa,CAAA;IAC5B,MAAM,EAAE,iBAAiB,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,EAAE,WAAW,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA8CjC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { waitForDDLPropagation } from '@chkit/clickhouse';
|
|
4
|
+
import { debug } from '../../runtime/debug.js';
|
|
5
|
+
import { checksumSQL } from '../../runtime/migration-store.js';
|
|
6
|
+
import { extractExecutableStatements, extractMigrationOperationSummaries, } from '../../runtime/safety-markers.js';
|
|
7
|
+
export async function applyMigration(input) {
|
|
8
|
+
const { db, journalStore, pluginRuntime, config, tableScope, flags, migrationsDir, file } = input;
|
|
9
|
+
debug('migrate', `applying ${file}`);
|
|
10
|
+
const sql = await readFile(join(migrationsDir, file), 'utf8');
|
|
11
|
+
const parsedStatements = extractExecutableStatements(sql);
|
|
12
|
+
const operationSummaries = extractMigrationOperationSummaries(sql);
|
|
13
|
+
debug('migrate', `${file}: ${parsedStatements.length} statements, ${operationSummaries.length} operations`);
|
|
14
|
+
const statements = await pluginRuntime.runOnBeforeApply({
|
|
15
|
+
command: 'migrate',
|
|
16
|
+
config,
|
|
17
|
+
tableScope,
|
|
18
|
+
flags,
|
|
19
|
+
migration: file,
|
|
20
|
+
sql,
|
|
21
|
+
statements: parsedStatements,
|
|
22
|
+
});
|
|
23
|
+
for (let i = 0; i < statements.length; i++) {
|
|
24
|
+
const statement = statements[i];
|
|
25
|
+
await db.command(statement);
|
|
26
|
+
const operation = operationSummaries[i];
|
|
27
|
+
if (operation) {
|
|
28
|
+
await waitForDDLPropagation(db, operation.type, operation.key);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const entry = {
|
|
32
|
+
name: file,
|
|
33
|
+
appliedAt: new Date().toISOString().replace('Z', ''),
|
|
34
|
+
checksum: checksumSQL(sql),
|
|
35
|
+
};
|
|
36
|
+
await journalStore.appendEntry(entry);
|
|
37
|
+
await pluginRuntime.runOnAfterApply({
|
|
38
|
+
command: 'migrate',
|
|
39
|
+
config,
|
|
40
|
+
tableScope,
|
|
41
|
+
flags,
|
|
42
|
+
migration: file,
|
|
43
|
+
statements,
|
|
44
|
+
appliedAt: entry.appliedAt,
|
|
45
|
+
});
|
|
46
|
+
return entry;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/commands/migrate/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,qBAAqB,EAA2B,MAAM,mBAAmB,CAAA;AAIlF,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAA8B,MAAM,kCAAkC,CAAA;AAC1F,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,iCAAiC,CAAA;AAIxC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KASpC;IACC,MAAM,EAAE,EAAE,EAAE,YA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EAAE,EAAE,CAAC;QACpD,QAAQ,EAAE,WAAW,CAAC,GAAG,CAAC;KAC3B,CAAA;IACD,MAAM,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IAErC,MAAM,aAAa,CAAC,eAAe,CAAC;QAClC,OAAO,EAAE,SAAS;QAClB,MAAM;QACN,UAAU;QACV,KAAK;QACL,SAAS,EAAE,IAAI;QACf,UAAU;QACV,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/migrate/command.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,UAAU,EAA0B,MAAM,kBAAkB,CAAA;AAgCnG,eAAO,MAAM,cAAc,EAAE,UAK5B,CAAA"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { mkdir } from 'node:fs/promises';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { defineFlags, typedFlags } from '../../plugins.js';
|
|
4
|
+
import { GLOBAL_FLAGS } from '../../runtime/global-flags.js';
|
|
5
|
+
import { emitJson } from '../../runtime/json-output.js';
|
|
6
|
+
import { createJournalStore } from '../../runtime/journal-store.js';
|
|
7
|
+
import { findChecksumMismatches, listMigrations, readSnapshot, } from '../../runtime/migration-store.js';
|
|
8
|
+
import { resolveTableScope, tableKeysFromDefinitions, } from '../../runtime/table-scope.js';
|
|
9
|
+
import { debug } from '../../runtime/debug.js';
|
|
10
|
+
import { applyMigration } from './apply.js';
|
|
11
|
+
import { scanDestructive } from './destructive.js';
|
|
12
|
+
import { confirmApply, confirmDestructiveExecution, isBackgroundOrCI, printDestructiveOperationDetails, } from './prompts.js';
|
|
13
|
+
import { filterPendingByScope } from './scope.js';
|
|
14
|
+
const MIGRATE_FLAGS = defineFlags([
|
|
15
|
+
{ name: '--apply', type: 'boolean', description: 'Apply pending migrations on ClickHouse (no prompt)' },
|
|
16
|
+
{ name: '--execute', type: 'boolean', description: 'Alias for --apply' },
|
|
17
|
+
{ name: '--allow-destructive', type: 'boolean', description: 'Allow destructive migrations tagged with risk=danger' },
|
|
18
|
+
]);
|
|
19
|
+
export const migrateCommand = {
|
|
20
|
+
name: 'migrate',
|
|
21
|
+
description: 'Review or execute pending migrations',
|
|
22
|
+
flags: MIGRATE_FLAGS,
|
|
23
|
+
run: cmdMigrate,
|
|
24
|
+
};
|
|
25
|
+
async function cmdMigrate(runCtx) {
|
|
26
|
+
const { flags, config, configPath, dirs, pluginRuntime, ctx } = runCtx;
|
|
27
|
+
const f = typedFlags(flags, [...GLOBAL_FLAGS, ...MIGRATE_FLAGS]);
|
|
28
|
+
const executeRequested = f['--apply'] === true || f['--execute'] === true;
|
|
29
|
+
const allowDestructive = f['--allow-destructive'] === true;
|
|
30
|
+
const tableSelector = f['--table'];
|
|
31
|
+
const jsonMode = f['--json'] === true;
|
|
32
|
+
const { migrationsDir, metaDir } = dirs;
|
|
33
|
+
debug('migrate', `flags: execute=${executeRequested}, allowDestructive=${allowDestructive}, json=${jsonMode}`);
|
|
34
|
+
if (!ctx.hasExecutor) {
|
|
35
|
+
throw new Error('clickhouse config is required for migrate (journal is stored in ClickHouse)');
|
|
36
|
+
}
|
|
37
|
+
const db = ctx.executor;
|
|
38
|
+
const journalStore = createJournalStore(db);
|
|
39
|
+
const snapshot = await readSnapshot(metaDir);
|
|
40
|
+
const tableScope = resolveTableScope(tableSelector, tableKeysFromDefinitions(snapshot?.definitions ?? []));
|
|
41
|
+
const mode = executeRequested ? 'execute' : 'plan';
|
|
42
|
+
await pluginRuntime.runOnConfigLoaded({
|
|
43
|
+
command: 'migrate',
|
|
44
|
+
config,
|
|
45
|
+
configPath,
|
|
46
|
+
tableScope,
|
|
47
|
+
flags,
|
|
48
|
+
});
|
|
49
|
+
await mkdir(migrationsDir, { recursive: true });
|
|
50
|
+
const files = await listMigrations(migrationsDir);
|
|
51
|
+
const journal = await journalStore.readJournal();
|
|
52
|
+
const appliedNames = new Set(journal.applied.map((entry) => entry.name));
|
|
53
|
+
const pendingAll = files.filter((file) => !appliedNames.has(file));
|
|
54
|
+
debug('migrate', `migrations: total=${files.length}, applied=${journal.applied.length}, pending=${pendingAll.length}`);
|
|
55
|
+
const checksumMismatches = await findChecksumMismatches(migrationsDir, journal);
|
|
56
|
+
if (checksumMismatches.length > 0) {
|
|
57
|
+
debug('migrate', `checksum mismatches: ${checksumMismatches.map((m) => m.name).join(', ')}`);
|
|
58
|
+
if (jsonMode) {
|
|
59
|
+
emitJson('migrate', {
|
|
60
|
+
mode,
|
|
61
|
+
scope: tableScope,
|
|
62
|
+
error: 'Checksum mismatch detected on applied migrations',
|
|
63
|
+
checksumMismatches,
|
|
64
|
+
});
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
throw new Error(`Checksum mismatch detected on applied migrations: ${checksumMismatches.map((item) => item.name).join(', ')}`);
|
|
69
|
+
}
|
|
70
|
+
if (tableScope.enabled && tableScope.matchCount === 0) {
|
|
71
|
+
if (jsonMode) {
|
|
72
|
+
emitJson('migrate', {
|
|
73
|
+
mode,
|
|
74
|
+
scope: tableScope,
|
|
75
|
+
pending: [],
|
|
76
|
+
applied: [],
|
|
77
|
+
warning: `No tables matched selector "${tableScope.selector ?? ''}".`,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
console.log(`No tables matched selector "${tableScope.selector ?? ''}". No migrations selected.`);
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const pending = tableScope.enabled
|
|
86
|
+
? await filterPendingByScope(migrationsDir, pendingAll, new Set(tableScope.matchedTables))
|
|
87
|
+
: pendingAll;
|
|
88
|
+
if (pending.length === 0) {
|
|
89
|
+
if (jsonMode) {
|
|
90
|
+
emitJson('migrate', { mode, scope: tableScope, pending: [], applied: [] });
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
console.log('No pending migrations.');
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (jsonMode && !executeRequested) {
|
|
98
|
+
emitJson('migrate', { mode, scope: tableScope, pending });
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!jsonMode) {
|
|
102
|
+
if (tableScope.enabled) {
|
|
103
|
+
console.log(`Table scope: ${tableScope.selector ?? ''} (${tableScope.matchCount} matched)`);
|
|
104
|
+
for (const table of tableScope.matchedTables)
|
|
105
|
+
console.log(`- ${table}`);
|
|
106
|
+
}
|
|
107
|
+
console.log(`Pending migrations: ${pending.length}`);
|
|
108
|
+
for (const file of pending)
|
|
109
|
+
console.log(`- ${file}`);
|
|
110
|
+
}
|
|
111
|
+
if (!executeRequested) {
|
|
112
|
+
if (isBackgroundOrCI() || jsonMode) {
|
|
113
|
+
if (!jsonMode) {
|
|
114
|
+
console.log('\nPlan only. Re-run with --apply to apply and journal these migrations.');
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const confirmed = await confirmApply();
|
|
119
|
+
if (!confirmed) {
|
|
120
|
+
console.log('Migration apply cancelled by user.');
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const destructive = await scanDestructive(migrationsDir, pending);
|
|
125
|
+
let destructiveAllowed = allowDestructive || config.safety?.allowDestructive === true;
|
|
126
|
+
if (destructive.migrations.length > 0 && !destructiveAllowed) {
|
|
127
|
+
const error = 'Blocked destructive migration execution. Re-run with --allow-destructive or set safety.allowDestructive=true after review.';
|
|
128
|
+
if (jsonMode) {
|
|
129
|
+
emitJson('migrate', {
|
|
130
|
+
mode: 'execute',
|
|
131
|
+
scope: tableScope,
|
|
132
|
+
error,
|
|
133
|
+
destructiveMigrations: destructive.migrations,
|
|
134
|
+
destructiveOperations: destructive.operations,
|
|
135
|
+
});
|
|
136
|
+
process.exitCode = 3;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (isBackgroundOrCI()) {
|
|
140
|
+
printDestructiveOperationDetails(destructive.operations);
|
|
141
|
+
throw new Error(`${error}\nDestructive migrations: ${destructive.migrations.join(', ')}\n` +
|
|
142
|
+
'Non-interactive run detected. Pass --allow-destructive to proceed.');
|
|
143
|
+
}
|
|
144
|
+
const confirmed = await confirmDestructiveExecution(destructive.operations);
|
|
145
|
+
if (!confirmed) {
|
|
146
|
+
throw new Error(`Destructive migration cancelled by user.\nDestructive migrations: ${destructive.migrations.join(', ')}`);
|
|
147
|
+
}
|
|
148
|
+
destructiveAllowed = true;
|
|
149
|
+
}
|
|
150
|
+
if (destructive.migrations.length > 0 && !destructiveAllowed) {
|
|
151
|
+
throw new Error('Blocked destructive migration execution.');
|
|
152
|
+
}
|
|
153
|
+
const appliedNow = [];
|
|
154
|
+
for (const file of pending) {
|
|
155
|
+
const entry = await applyMigration({
|
|
156
|
+
db,
|
|
157
|
+
journalStore,
|
|
158
|
+
pluginRuntime,
|
|
159
|
+
config,
|
|
160
|
+
tableScope,
|
|
161
|
+
flags,
|
|
162
|
+
migrationsDir,
|
|
163
|
+
file,
|
|
164
|
+
});
|
|
165
|
+
appliedNow.push(entry);
|
|
166
|
+
if (!jsonMode)
|
|
167
|
+
console.log(`Applied: ${file}`);
|
|
168
|
+
}
|
|
169
|
+
if (jsonMode) {
|
|
170
|
+
emitJson('migrate', { mode: 'execute', scope: tableScope, applied: appliedNow });
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
console.log('\nMigrations recorded in ClickHouse _chkit_migrations table.');
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/commands/migrate/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,OAAO,MAAM,cAAc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AAC;QACb,QAAQ,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;QAChF,OAAM;IACR,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAA;AAC7E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type DestructiveOperationMarker } from '../../runtime/safety-markers.js';
|
|
2
|
+
export interface DestructiveScan {
|
|
3
|
+
migrations: string[];
|
|
4
|
+
operations: DestructiveOperationMarker[];
|
|
5
|
+
}
|
|
6
|
+
export declare function scanDestructive(migrationsDir: string, pending: string[]): Promise<DestructiveScan>;
|
|
7
|
+
//# sourceMappingURL=destructive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destructive.d.ts","sourceRoot":"","sources":["../../../src/commands/migrate/destructive.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,iCAAiC,CAAA;AAExC,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,UAAU,EAAE,0BAA0B,EAAE,CAAA;CACzC;AAED,wBAAsB,eAAe,CACnC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,eAAe,CAAC,CAW1B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { collectDestructiveOperationMarkers, migrationContainsDangerOperation, } from '../../runtime/safety-markers.js';
|
|
4
|
+
export async function scanDestructive(migrationsDir, pending) {
|
|
5
|
+
const migrations = [];
|
|
6
|
+
const operations = [];
|
|
7
|
+
for (const file of pending) {
|
|
8
|
+
const sql = await readFile(join(migrationsDir, file), 'utf8');
|
|
9
|
+
if (migrationContainsDangerOperation(sql)) {
|
|
10
|
+
migrations.push(file);
|
|
11
|
+
operations.push(...collectDestructiveOperationMarkers(file, sql));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return { migrations, operations };
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=destructive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destructive.js","sourceRoot":"","sources":["../../../src/commands/migrate/destructive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EACL,kCAAkC,EAClC,gCAAgC,GAEjC,MAAM,iCAAiC,CAAA;AAOxC,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,aAAqB,EACrB,OAAiB;IAEjB,MAAM,UAAU,GAAa,EAAE,CAAA;IAC/B,MAAM,UAAU,GAAiC,EAAE,CAAA;IACnD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAA;QAC7D,IAAI,gCAAgC,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACrB,UAAU,CAAC,IAAI,CAAC,GAAG,kCAAkC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;QACnE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA;AACnC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DestructiveOperationMarker } from '../../runtime/safety-markers.js';
|
|
2
|
+
export declare function isBackgroundOrCI(): boolean;
|
|
3
|
+
export declare function printDestructiveOperationDetails(markers: DestructiveOperationMarker[]): void;
|
|
4
|
+
export declare function confirmApply(): Promise<boolean>;
|
|
5
|
+
export declare function confirmDestructiveExecution(markers: DestructiveOperationMarker[]): Promise<boolean>;
|
|
6
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/commands/migrate/prompts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAEjF,wBAAgB,gBAAgB,IAAI,OAAO,CAO1C;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,0BAA0B,EAAE,GAAG,IAAI,CAW5F;AAcD,wBAAgB,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,CAE/C;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,0BAA0B,EAAE,GACpC,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { createInterface } from 'node:readline/promises';
|
|
3
|
+
export function isBackgroundOrCI() {
|
|
4
|
+
return (process.env.CI === '1' ||
|
|
5
|
+
process.env.CI === 'true' ||
|
|
6
|
+
!process.stdin.isTTY ||
|
|
7
|
+
!process.stdout.isTTY);
|
|
8
|
+
}
|
|
9
|
+
export function printDestructiveOperationDetails(markers) {
|
|
10
|
+
console.log('Destructive operations detected:');
|
|
11
|
+
for (const [index, marker] of markers.entries()) {
|
|
12
|
+
console.log(`${index + 1}. ${marker.migration}`);
|
|
13
|
+
console.log(` operation: ${marker.type}`);
|
|
14
|
+
console.log(` key: ${marker.key}`);
|
|
15
|
+
console.log(` warning: ${marker.warningCode}`);
|
|
16
|
+
console.log(` reason: ${marker.reason}`);
|
|
17
|
+
console.log(` impact: ${marker.impact}`);
|
|
18
|
+
console.log(` recommendation: ${marker.recommendation}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function promptYes(message) {
|
|
22
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
23
|
+
try {
|
|
24
|
+
console.log('');
|
|
25
|
+
console.log('Type "yes" to continue. Any other input cancels.');
|
|
26
|
+
const response = await rl.question(message);
|
|
27
|
+
return response.trim().toLowerCase() === 'yes';
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
rl.close();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function confirmApply() {
|
|
34
|
+
return promptYes('Apply pending migrations now? [no/yes]: ');
|
|
35
|
+
}
|
|
36
|
+
export async function confirmDestructiveExecution(markers) {
|
|
37
|
+
printDestructiveOperationDetails(markers);
|
|
38
|
+
return promptYes('Apply destructive operations? [no/yes]: ');
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/commands/migrate/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAIxD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG;QACtB,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,MAAM;QACzB,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK;QACpB,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CACtB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,OAAqC;IACpF,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;IAC/C,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC,CAAA;QAChD,OAAO,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;Q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