Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

refactor: drop --force flag from migrations (#3447)

Bogdan Chadkin0883212cdb26
diff --git a/apps/builder/package.json b/apps/builder/package.json
index 720471aa8c..5b0e64c5dd 100644
--- a/apps/builder/package.json
+++ b/apps/builder/package.json
@@ -13,7 +13,7 @@
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
"checks": "pnpm typecheck && pnpm test",
- "ci:migrate": "migrations migrate --force",
+ "ci:migrate": "migrations migrate",
"middleware:link": "pnpx vercel link",
"middleware:env": "pnpx vercel env pull --environment=preview ./.env.preview",
"middleware:dev": "DOTENV_CONFIG_PATH=.env.preview tsx watch -r dotenv/config ./middleware.js"
diff --git a/packages/prisma-client/migrations-cli/README.md b/packages/prisma-client/migrations-cli/README.md
index 238feca6c6..d411066c64 100644
--- a/packages/prisma-client/migrations-cli/README.md
+++ b/packages/prisma-client/migrations-cli/README.md
@@ -89,7 +89,7 @@ You have several options:
### How do I apply migrations in a deployment environment?
- Make sure your `schema.prisma` file points to the correct database.
-- Add `migrations migrate --force` to your deploy script.
+- Add `migrations migrate` to your deploy script.
## CLI Reference
@@ -100,10 +100,6 @@ This flag can be added to any command. It informs the CLI that it’s used in a
- automatically loads variables from `.env` files,
- uses a lockfile to avoid running more than one migration process at the same time.
-### `--force`
-
-This flag can be added to any command. It prevents the CLI from asking for confirmation before executing the command.
-
### `create-schema <name>`
Example: `$ migrations create-schema add_projects_table`
diff --git a/packages/prisma-client/migrations-cli/TROUBLESHOOTING.md b/packages/prisma-client/migrations-cli/TROUBLESHOOTING.md
index 63225da383..d91b85bbe2 100644
--- a/packages/prisma-client/migrations-cli/TROUBLESHOOTING.md
+++ b/packages/prisma-client/migrations-cli/TROUBLESHOOTING.md
@@ -5,7 +5,7 @@
1. Set APPLY_MIGRATIONS to "true" for your PR's branch
1. Fix the failed migration code
1. Fix the database mannually if the migration have been applied half-way
-1. Temporarily change `ci:migrate` script to run `resolve` before applying migrations: `"ci:migrate": "migrations resolve rolled-back <name> --force && migrations migrate --force"`. Use `applied` instead of `rolled-back` if you manually applied the migration at previous step.
+1. Temporarily change `ci:migrate` script to run `resolve` before applying migrations: `"ci:migrate": "migrations resolve rolled-back <name> --force && migrations migrate"`. Use `applied` instead of `rolled-back` if you manually applied the migration at previous step.
1. Commit the changes and check Vercel logs to see if the migration is applied
1. Change `ci:migrate` script back to normal
1. Merge the PR
diff --git a/packages/prisma-client/migrations-cli/args.ts b/packages/prisma-client/migrations-cli/args.ts
index 775f9a179b..3587f1ad22 100644
--- a/packages/prisma-client/migrations-cli/args.ts
+++ b/packages/prisma-client/migrations-cli/args.ts
@@ -7,8 +7,5 @@ export const { values, positionals } = parseArgs({
dev: {
type: "boolean",
},
- force: {
- type: "boolean",
- },
},
});
diff --git a/packages/prisma-client/migrations-cli/cli.ts b/packages/prisma-client/migrations-cli/cli.ts
index 5543023da8..8b2ce09d00 100755
--- a/packages/prisma-client/migrations-cli/cli.ts
+++ b/packages/prisma-client/migrations-cli/cli.ts
@@ -19,7 +19,6 @@ Commands:
Arguments
--dev — Lets the CLI know that it's running in a development environment
- --force — Skips the confirmation prompt when running a dangerous command
`;
const main = async () => {
diff --git a/packages/prisma-client/migrations-cli/commands.ts b/packages/prisma-client/migrations-cli/commands.ts
index 48876f32a3..e11a103690 100644
--- a/packages/prisma-client/migrations-cli/commands.ts
+++ b/packages/prisma-client/migrations-cli/commands.ts
@@ -1,7 +1,6 @@
import fs from "node:fs";
import path from "node:path";
import { FileLocker, MigrationMeta } from "umzug";
-import prompts from "prompts";
import { inspect } from "node:util";
import * as prismaMigrations from "./prisma-migrations";
import { umzug } from "./umzug";
@@ -15,24 +14,6 @@ const templateFilePath = path.join(
);
const lockfilePath = path.join(prismaMigrations.migrationsDir, "lockfile");
-const ensureUserWantsToContinue = async (defaultResult = false) => {
- if (args.values.force) {
- return;
- }
-
- const { shouldContinue } = await prompts({
- type: "confirm",
- name: "shouldContinue",
- message: "Continue?",
- initial: defaultResult,
- });
-
- if (shouldContinue === false) {
- logger.info("Aborted.");
- process.exit(0);
- }
-};
-
const writeFile = (filePath: string, content: string) => {
const dir = path.dirname(filePath);
if (!fs.existsSync(dir)) {
@@ -359,8 +340,6 @@ export const resolve = async ({
);
logger.info("");
- await ensureUserWantsToContinue();
-
if (resolveAs === "applied") {
await prismaMigrations.setApplied(migrationName);
logger.info(`Resolved ${migrationName} as applied`);
@@ -382,8 +361,6 @@ export const reset = async () => {
logger.info("and run all migrations from scratch!");
logger.info("");
- await ensureUserWantsToContinue();
-
await prismaMigrations.resetDatabase();
await up();
};
diff --git a/packages/prisma-client/package.json b/packages/prisma-client/package.json
index dedbea6fa9..30bacaff82 100644
--- a/packages/prisma-client/package.json
+++ b/packages/prisma-client/package.json
@@ -21,7 +21,6 @@
"devDependencies": {
"@prisma/client": "^5.12.1",
"@types/node": "^20.12.7",
- "@types/prompts": "^2.4.5",
"@webstudio-is/tsconfig": "workspace:*",
"prisma": "^5.12.1",
"tsx": "^4.7.2",
@@ -39,7 +38,6 @@
"dotenv": "^16.3.1",
"execa": "^7.2.0",
"nanoid": "^5.0.1",
- "prompts": "^2.4.2",
"umzug": "^3.2.1"
},
"peerDependencies": {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 93c229bbbe..498c7d140a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1606,9 +1606,6 @@ importers:
nanoid:
specifier: ^5.0.1
version: 5.0.1
- prompts:
- specifier: ^2.4.2
- version: 2.4.2
umzug:
specifier: ^3.2.1
version: 3.2.1
@@ -1619,9 +1616,6 @@ importers:
'@types/node':
specifier: ^20.12.7
version: 20.12.7
- '@types/prompts':
- specifier: ^2.4.5
- version: 2.4.5
'@webstudio-is/tsconfig':
specifier: workspace:*
version: link:../tsconfig