From 1edebdf8a5f574cd1d2104a47d54f97ef3eac746 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Thu, 4 Apr 2024 17:04:06 -0700 Subject: [PATCH] Fix: Improve create migration script --- backend/scripts/create-migration.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/scripts/create-migration.ts b/backend/scripts/create-migration.ts index f4017b12b..59040a37a 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" } );