From 05bf5b88b06249ad51c58d901b126e5962aceeb3 Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Fri, 3 Jul 2026 13:35:30 +0200 Subject: [PATCH] refactor: drop random slug from auto-generated migration names Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/src/lib/components/dbOps.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/components/dbOps.ts b/frontend/src/lib/components/dbOps.ts index f804bc14a8..1305492687 100644 --- a/frontend/src/lib/components/dbOps.ts +++ b/frontend/src/lib/components/dbOps.ts @@ -10,7 +10,6 @@ import { stringifySchema } from './copilot/lib' import type { DbInput, DbType } from './dbTypes' import { assert } from '$lib/utils' import { WorkspaceService } from '$lib/gen' -import { randomUUID } from '$lib/utils/uuid' import { buildTableEditorValues, type TableEditorValues @@ -268,12 +267,11 @@ export function dbSchemaOpsWithPreviewScripts({ return `-- WM_INTERNAL_DB_${op} ${JSON.stringify(payload)}` } - // Auto-generated migration name, e.g. `create_customers_2da8`. The slug keeps - // successive changes to the same object from colliding on the same timestamp. + // Auto-generated migration name, e.g. `create_customers`. The server allocates + // a unique timestamp (bumping on collision), so the name itself need not be unique. function migrationName(op: string, target: string): string { - const slug = randomUUID().slice(0, 4) const safe = target.replace(/[^a-zA-Z0-9_-]+/g, '_').replace(/^_+|_+$/g, '') - return safe ? `${op}_${safe}_${slug}` : `${op}_${slug}` + return safe ? `${op}_${safe}` : op } // A dropped SERIAL column reports its default as `nextval()` of an owned