spfn 0.2.0-beta.34 → 0.2.0-beta.35
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 +16 -9
- package/package.json +2 -2
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.35";
|
|
759
759
|
}
|
|
760
760
|
function getTagFromVersion(version) {
|
|
761
761
|
const match = version.match(/-([a-z]+)\./i);
|
|
@@ -2433,17 +2433,20 @@ async function dbPush(options = {}) {
|
|
|
2433
2433
|
const { db, close } = await createPushConnection();
|
|
2434
2434
|
try {
|
|
2435
2435
|
const { pushSchema } = await import("drizzle-kit/api");
|
|
2436
|
-
const { statementsToExecute
|
|
2436
|
+
const { statementsToExecute } = await pushSchema(
|
|
2437
2437
|
imports,
|
|
2438
2438
|
db,
|
|
2439
2439
|
config.schemaFilter ?? ["public"]
|
|
2440
2440
|
);
|
|
2441
|
-
|
|
2441
|
+
const statements = statementsToExecute.map(
|
|
2442
|
+
(s) => s.replace(/^CREATE SCHEMA(?!\s+IF\s+NOT\s+EXISTS)/i, "CREATE SCHEMA IF NOT EXISTS")
|
|
2443
|
+
);
|
|
2444
|
+
if (statements.length === 0) {
|
|
2442
2445
|
console.log(chalk13.green("\u2705 No changes detected \u2014 database is up to date\n"));
|
|
2443
2446
|
await applyFunctionMigrations();
|
|
2444
2447
|
return;
|
|
2445
2448
|
}
|
|
2446
|
-
const result = classifyStatements(
|
|
2449
|
+
const result = classifyStatements(statements);
|
|
2447
2450
|
if (options.dryRun) {
|
|
2448
2451
|
displayDryRunSummary(result);
|
|
2449
2452
|
return;
|
|
@@ -2451,11 +2454,15 @@ async function dbPush(options = {}) {
|
|
|
2451
2454
|
displayClassifiedStatements(result);
|
|
2452
2455
|
if (options.force) {
|
|
2453
2456
|
console.log(chalk13.dim("\n--force: applying all changes..."));
|
|
2454
|
-
|
|
2455
|
-
|
|
2457
|
+
for (const stmt of statements) {
|
|
2458
|
+
await db.execute(sql.raw(stmt));
|
|
2459
|
+
}
|
|
2460
|
+
displayApplySummary(statements.length, 0);
|
|
2456
2461
|
} else if (result.destructive.length === 0) {
|
|
2457
|
-
|
|
2458
|
-
|
|
2462
|
+
for (const stmt of statements) {
|
|
2463
|
+
await db.execute(sql.raw(stmt));
|
|
2464
|
+
}
|
|
2465
|
+
displayApplySummary(statements.length, 0);
|
|
2459
2466
|
} else {
|
|
2460
2467
|
const safeCount = result.safe.length + result.warning.length;
|
|
2461
2468
|
if (safeCount > 0) {
|
|
@@ -2481,7 +2488,7 @@ async function dbPush(options = {}) {
|
|
|
2481
2488
|
for (const stmt of result.destructive) {
|
|
2482
2489
|
await db.execute(sql.raw(stmt.sql));
|
|
2483
2490
|
}
|
|
2484
|
-
displayApplySummary(
|
|
2491
|
+
displayApplySummary(statements.length, 0);
|
|
2485
2492
|
} else {
|
|
2486
2493
|
displayApplySummary(safeCount, result.destructive.length);
|
|
2487
2494
|
console.log(chalk13.dim("Tip: Use --force to apply all changes without prompting.\n"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spfn",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.35",
|
|
4
4
|
"description": "Superfunction CLI - Add SPFN to your Next.js project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"postgres": "^3.4.0",
|
|
69
69
|
"prompts": "^2.4.2",
|
|
70
70
|
"tsup": "^8.5.0",
|
|
71
|
-
"@spfn/core": "0.2.0-beta.
|
|
71
|
+
"@spfn/core": "0.2.0-beta.37"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/fs-extra": "^11.0.4",
|