spfn 0.2.0-beta.17 → 0.2.0-beta.18
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 +17 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -755,7 +755,7 @@ var init_deployment_config = __esm({
|
|
|
755
755
|
|
|
756
756
|
// src/utils/version.ts
|
|
757
757
|
function getCliVersion() {
|
|
758
|
-
return "0.2.0-beta.
|
|
758
|
+
return "0.2.0-beta.18";
|
|
759
759
|
}
|
|
760
760
|
function getTagFromVersion(version) {
|
|
761
761
|
const match = version.match(/-([a-z]+)\./i);
|
|
@@ -1103,7 +1103,10 @@ async function executeFunctionMigrations(functionMigrations) {
|
|
|
1103
1103
|
for (const func of functionMigrations) {
|
|
1104
1104
|
console.log(chalk11.blue(`
|
|
1105
1105
|
\u{1F4E6} Running ${func.packageName} migrations...`));
|
|
1106
|
-
await migrate(db, {
|
|
1106
|
+
await migrate(db, {
|
|
1107
|
+
migrationsFolder: func.migrationsDir,
|
|
1108
|
+
migrationsTable: "__spfn_fn_migrations"
|
|
1109
|
+
});
|
|
1107
1110
|
console.log(chalk11.green(` \u2713 ${func.packageName} migrations applied`));
|
|
1108
1111
|
executedCount++;
|
|
1109
1112
|
}
|
|
@@ -2584,6 +2587,8 @@ async function dbBackup(options) {
|
|
|
2584
2587
|
// src/commands/db/migrate.ts
|
|
2585
2588
|
import { env as env4 } from "@spfn/core/config";
|
|
2586
2589
|
import { loadEnv as loadEnv4 } from "@spfn/core/server";
|
|
2590
|
+
var FUNCTION_MIGRATIONS_TABLE = "__spfn_fn_migrations";
|
|
2591
|
+
var PROJECT_MIGRATIONS_TABLE = "__drizzle_migrations";
|
|
2587
2592
|
async function dbMigrate(options = {}) {
|
|
2588
2593
|
try {
|
|
2589
2594
|
validateDatabasePrerequisites();
|
|
@@ -2620,7 +2625,10 @@ async function dbMigrate(options = {}) {
|
|
|
2620
2625
|
for (const func of functions) {
|
|
2621
2626
|
console.log(chalk16.blue(`
|
|
2622
2627
|
\u{1F4E6} Running ${func.packageName} migrations...`));
|
|
2623
|
-
await migrate(fnDb, {
|
|
2628
|
+
await migrate(fnDb, {
|
|
2629
|
+
migrationsFolder: func.migrationsDir,
|
|
2630
|
+
migrationsTable: FUNCTION_MIGRATIONS_TABLE
|
|
2631
|
+
});
|
|
2624
2632
|
console.log(chalk16.green(` \u2713 ${func.packageName} migrations applied`));
|
|
2625
2633
|
}
|
|
2626
2634
|
console.log(chalk16.green("\u2705 Function migrations applied\n"));
|
|
@@ -2633,20 +2641,12 @@ async function dbMigrate(options = {}) {
|
|
|
2633
2641
|
const projConn = postgres.default(env4.DATABASE_URL, { max: 1 });
|
|
2634
2642
|
const projDb = drizzle(projConn);
|
|
2635
2643
|
try {
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
SELECT count(*)::int as count FROM drizzle.__drizzle_migrations
|
|
2643
|
-
`;
|
|
2644
|
-
const applied = afterCount[0].count - beforeCount[0].count;
|
|
2645
|
-
if (applied > 0) {
|
|
2646
|
-
console.log(chalk16.green(`\u2705 Project migrations applied successfully (${applied} new)`));
|
|
2647
|
-
} else {
|
|
2648
|
-
console.log(chalk16.yellow(`\u26A0\uFE0F No new project migrations to apply (${afterCount[0].count} already recorded)`));
|
|
2649
|
-
}
|
|
2644
|
+
console.log(chalk16.blue("\u{1F4E6} Running project migrations..."));
|
|
2645
|
+
await migrate(projDb, {
|
|
2646
|
+
migrationsFolder: projectMigrationsDir,
|
|
2647
|
+
migrationsTable: PROJECT_MIGRATIONS_TABLE
|
|
2648
|
+
});
|
|
2649
|
+
console.log(chalk16.green("\u2705 Project migrations applied successfully"));
|
|
2650
2650
|
} finally {
|
|
2651
2651
|
await projConn.end();
|
|
2652
2652
|
}
|