@cleverbrush/orm-cli 0.0.0-beta-20260425100706 → 0.0.0-beta-20260426141150
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/bin.js +1 -1
- package/dist/{cli-XMDVRIZG.js → cli-Q4EBNEOJ.js} +20 -10
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -68,6 +68,7 @@ async function run(argv) {
|
|
|
68
68
|
}
|
|
69
69
|
const flags = parseFlags(rest);
|
|
70
70
|
const configPath = flags["--config"];
|
|
71
|
+
let loadedConfig;
|
|
71
72
|
try {
|
|
72
73
|
if (cmd === "migrate") {
|
|
73
74
|
switch (sub) {
|
|
@@ -83,27 +84,27 @@ async function run(argv) {
|
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
+
loadedConfig = await loadConfig(configPath);
|
|
87
88
|
const { generate } = await import("./generate-CMLVA6DT.js");
|
|
88
|
-
await generate(name,
|
|
89
|
+
await generate(name, loadedConfig, flags);
|
|
89
90
|
break;
|
|
90
91
|
}
|
|
91
92
|
case "run": {
|
|
92
|
-
|
|
93
|
+
loadedConfig = await loadConfig(configPath);
|
|
93
94
|
const { run: runMigrations } = await import("./run-PSIPMF6V.js");
|
|
94
|
-
await runMigrations(
|
|
95
|
+
await runMigrations(loadedConfig, flags);
|
|
95
96
|
break;
|
|
96
97
|
}
|
|
97
98
|
case "rollback": {
|
|
98
|
-
|
|
99
|
+
loadedConfig = await loadConfig(configPath);
|
|
99
100
|
const { rollback } = await import("./rollback-AVV6DTXF.js");
|
|
100
|
-
await rollback(
|
|
101
|
+
await rollback(loadedConfig, flags);
|
|
101
102
|
break;
|
|
102
103
|
}
|
|
103
104
|
case "status": {
|
|
104
|
-
|
|
105
|
+
loadedConfig = await loadConfig(configPath);
|
|
105
106
|
const { status } = await import("./status-W3A6JWR3.js");
|
|
106
|
-
await status(
|
|
107
|
+
await status(loadedConfig, flags);
|
|
107
108
|
break;
|
|
108
109
|
}
|
|
109
110
|
default:
|
|
@@ -114,9 +115,9 @@ async function run(argv) {
|
|
|
114
115
|
} else if (cmd === "db") {
|
|
115
116
|
switch (sub) {
|
|
116
117
|
case "push": {
|
|
117
|
-
|
|
118
|
+
loadedConfig = await loadConfig(configPath);
|
|
118
119
|
const { push } = await import("./push-SNCDOATW.js");
|
|
119
|
-
await push(
|
|
120
|
+
await push(loadedConfig, flags);
|
|
120
121
|
break;
|
|
121
122
|
}
|
|
122
123
|
default:
|
|
@@ -128,6 +129,7 @@ async function run(argv) {
|
|
|
128
129
|
fatal(`Unknown command: ${cmd}. Run \`cb-orm --help\` for usage.`);
|
|
129
130
|
}
|
|
130
131
|
} catch (err) {
|
|
132
|
+
await destroyKnex(loadedConfig);
|
|
131
133
|
console.error(
|
|
132
134
|
`
|
|
133
135
|
Error: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -135,6 +137,14 @@ Error: ${err instanceof Error ? err.message : String(err)}
|
|
|
135
137
|
);
|
|
136
138
|
process.exit(1);
|
|
137
139
|
}
|
|
140
|
+
await destroyKnex(loadedConfig);
|
|
141
|
+
}
|
|
142
|
+
async function destroyKnex(config) {
|
|
143
|
+
if (!config?.knex) return;
|
|
144
|
+
try {
|
|
145
|
+
await config.knex.destroy();
|
|
146
|
+
} catch {
|
|
147
|
+
}
|
|
138
148
|
}
|
|
139
149
|
function parseFlags(args) {
|
|
140
150
|
const flags = {};
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"cb-orm": "./dist/bin.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@cleverbrush/knex-schema": "0.0.0-beta-
|
|
11
|
+
"@cleverbrush/knex-schema": "0.0.0-beta-20260426141150",
|
|
12
12
|
"tsx": "^4.19.0"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
},
|
|
49
49
|
"type": "module",
|
|
50
50
|
"types": "./dist/index.d.ts",
|
|
51
|
-
"version": "0.0.0-beta-
|
|
51
|
+
"version": "0.0.0-beta-20260426141150"
|
|
52
52
|
}
|