@insforge/cli 0.1.28 → 0.1.30
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 +14 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2281,31 +2281,22 @@ async function downloadGitHubTemplate(templateName, projectConfig, json) {
|
|
|
2281
2281
|
await fs3.writeFile(path3.join(cwd, ".env.local"), envContent);
|
|
2282
2282
|
}
|
|
2283
2283
|
s?.stop(`${templateName} template downloaded`);
|
|
2284
|
-
const migrationPath = path3.join(cwd, "migrations", "
|
|
2284
|
+
const migrationPath = path3.join(cwd, "migrations", "db_init.sql");
|
|
2285
2285
|
const migrationExists = await fs3.stat(migrationPath).catch(() => null);
|
|
2286
2286
|
if (migrationExists) {
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
dbSpinner?.stop("Database migrations applied");
|
|
2301
|
-
} catch (err) {
|
|
2302
|
-
dbSpinner?.stop("Database migration failed");
|
|
2303
|
-
if (!json) {
|
|
2304
|
-
clack10.log.warn(`Migration failed: ${err.message}`);
|
|
2305
|
-
clack10.log.info('You can run the migration manually: insforge db query --unrestricted "$(cat migrations/db_int.sql)"');
|
|
2306
|
-
} else {
|
|
2307
|
-
throw err;
|
|
2308
|
-
}
|
|
2287
|
+
const dbSpinner = !json ? clack10.spinner() : null;
|
|
2288
|
+
dbSpinner?.start("Running database migrations...");
|
|
2289
|
+
try {
|
|
2290
|
+
const sql = await fs3.readFile(migrationPath, "utf-8");
|
|
2291
|
+
await runRawSql(sql, true);
|
|
2292
|
+
dbSpinner?.stop("Database migrations applied");
|
|
2293
|
+
} catch (err) {
|
|
2294
|
+
dbSpinner?.stop("Database migration failed");
|
|
2295
|
+
if (!json) {
|
|
2296
|
+
clack10.log.warn(`Migration failed: ${err.message}`);
|
|
2297
|
+
clack10.log.info('You can run the migration manually: insforge db query --unrestricted "$(cat migrations/db_init.sql)"');
|
|
2298
|
+
} else {
|
|
2299
|
+
throw err;
|
|
2309
2300
|
}
|
|
2310
2301
|
}
|
|
2311
2302
|
}
|