@stacksjs/buddy 0.70.108 → 0.70.110
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/commands/migrate.js +13 -8
- package/package.json +1 -1
package/dist/commands/migrate.js
CHANGED
|
@@ -83,7 +83,7 @@ async function reportMissingForeignKeys() {
|
|
|
83
83
|
+ ${result.missing.length - 5} more \u2014 run \`./buddy doctor\` for the full list.` : "";
|
|
84
84
|
log.warn(`${result.missing.length} of ${result.declared.length} declared foreign keys are missing from the live schema:
|
|
85
85
|
${sample}${more}
|
|
86
|
-
` + "
|
|
86
|
+
` + "The model-backed create migrations may be stale for this database \u2014 run `./buddy migrate:fresh` to regenerate and replay them from the model attributes (this resets data).");
|
|
87
87
|
} catch (err) {
|
|
88
88
|
log.debug(`[migrate] FK integrity check skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
89
89
|
}
|
|
@@ -244,22 +244,27 @@ export function migrate(buddy) {
|
|
|
244
244
|
if (options.auth !== !1) {
|
|
245
245
|
log.debug("Migrating auth tables...");
|
|
246
246
|
try {
|
|
247
|
-
const { migrateAuthTables
|
|
247
|
+
const { migrateAuthTables } = await import("@stacksjs/database"), authResult = await migrateAuthTables({ verbose: options.verbose });
|
|
248
248
|
if (!authResult.success)
|
|
249
249
|
log.error(`Failed to migrate auth tables: ${authResult.error}`);
|
|
250
|
-
|
|
250
|
+
} catch (error) {
|
|
251
|
+
log.error("Failed to migrate auth tables:", error);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const result = await runAction(Action.Migrate, options).finally(() => lock.release());
|
|
255
|
+
if (result.isErr)
|
|
256
|
+
log.error("Model migrations failed \u2014 applying notification/RBAC table guarantees before exiting.");
|
|
257
|
+
if (options.auth !== !1)
|
|
258
|
+
try {
|
|
259
|
+
const { migrateNotificationTables, migrateRbacTables } = await import("@stacksjs/database"), notifResult = await migrateNotificationTables({ verbose: options.verbose });
|
|
251
260
|
if (!notifResult.success)
|
|
252
261
|
log.error(`Failed to migrate notification tables: ${notifResult.error}`);
|
|
253
262
|
const rbacResult = await migrateRbacTables({ verbose: options.verbose });
|
|
254
263
|
if (!rbacResult.success)
|
|
255
264
|
log.error(`Failed to migrate RBAC tables: ${rbacResult.error}`);
|
|
256
265
|
} catch (error) {
|
|
257
|
-
log.error("Failed to migrate
|
|
266
|
+
log.error("Failed to migrate notification/RBAC tables:", error);
|
|
258
267
|
}
|
|
259
|
-
}
|
|
260
|
-
const result = await runAction(Action.Migrate, options).finally(() => lock.release());
|
|
261
|
-
if (result.isErr)
|
|
262
|
-
log.error("Model migrations failed.");
|
|
263
268
|
if (result.isErr) {
|
|
264
269
|
await outro("While running the migrate command, there was an issue", { startTime: perf, useSeconds: !0 }, result.error);
|
|
265
270
|
process.exit(ExitCode.FatalError);
|