Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix: Improve create migration script

Daniel Hougaard1edebdf8a5f5
diff --git a/backend/scripts/create-migration.ts b/backend/scripts/create-migration.ts
index f4017b12b1..59040a37ac 100644
--- a/backend/scripts/create-migration.ts
+++ b/backend/scripts/create-migration.ts
@@ -7,10 +7,10 @@ const prompt = promptSync({ sigint: true });
const migrationName = prompt("Enter name for migration: ");
+// Remove spaces from migration name and replace with hyphens
+const formattedMigrationName = migrationName.replace(/\s+/g, "-");
+
execSync(
- `npx knex migrate:make --knexfile ${path.join(
- __dirname,
- "../src/db/knexfile.ts"
- )} -x ts ${migrationName}`,
+ `npx knex migrate:make --knexfile ${path.join(__dirname, "../src/db/knexfile.ts")} -x ts ${formattedMigrationName}`,
{ stdio: "inherit" }
);