@weirdfingers/baseboards 0.9.2 → 0.9.4

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/index.js CHANGED
@@ -8081,7 +8081,7 @@ async function waitForHealthy(ctx) {
8081
8081
  async function runMigrations(ctx) {
8082
8082
  const spinner = ora2("Running database migrations...").start();
8083
8083
  try {
8084
- await execa2(
8084
+ const { stdout } = await execa2(
8085
8085
  "docker",
8086
8086
  [
8087
8087
  ...getComposeBaseArgs(ctx),
@@ -8096,7 +8096,21 @@ async function runMigrations(ctx) {
8096
8096
  cwd: ctx.dir
8097
8097
  }
8098
8098
  );
8099
+ if (stdout && (stdout.includes("Running upgrade") || process.env.DEBUG)) {
8100
+ console.log(chalk2.gray("\n Migration output:"));
8101
+ console.log(chalk2.gray(" " + stdout.split("\n").join("\n ")));
8102
+ }
8099
8103
  spinner.succeed("Database migrations complete");
8104
+ spinner.start("Restarting API to apply migrations...");
8105
+ await execa2(
8106
+ "docker",
8107
+ [...getComposeBaseArgs(ctx), "restart", "api"],
8108
+ {
8109
+ cwd: ctx.dir
8110
+ }
8111
+ );
8112
+ await new Promise((resolve) => setTimeout(resolve, 2e3));
8113
+ spinner.succeed("API restarted");
8100
8114
  } catch (error) {
8101
8115
  spinner.fail("Database migrations failed");
8102
8116
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -8125,17 +8139,23 @@ async function runMigrations(ctx) {
8125
8139
  )
8126
8140
  );
8127
8141
  } else {
8142
+ console.log(
8143
+ chalk2.red(
8144
+ "\n\u274C Database migrations failed"
8145
+ )
8146
+ );
8147
+ console.log(chalk2.gray("\n Error details:"));
8148
+ console.log(chalk2.gray(" " + errorMessage));
8128
8149
  console.log(
8129
8150
  chalk2.yellow(
8130
- "\n\u26A0\uFE0F Database migrations failed. You may need to run them manually:"
8151
+ "\n You can try running migrations manually:"
8131
8152
  )
8132
8153
  );
8133
8154
  console.log(
8134
8155
  chalk2.cyan(" docker compose exec api alembic upgrade head")
8135
8156
  );
8136
- console.log(chalk2.gray("\n Error details:"));
8137
- console.log(chalk2.gray(" " + errorMessage));
8138
8157
  }
8158
+ throw new Error("Database migrations failed");
8139
8159
  }
8140
8160
  }
8141
8161
  function getDevCommand(pm) {