원클릭으로
new-migration
Create a new database migration file with the correct next ID, preventing duplicates
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Create a new database migration file with the correct next ID, preventing duplicates
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | new-migration |
| description | Create a new database migration file with the correct next ID, preventing duplicates |
| argument-hint | <description> (e.g. add_status_to_contacts) |
Create a new database migration SQL file. Follow these steps exactly:
Read the current migration files in src/infrastructure/database/migrations/ and find the highest numbered migration file. The new migration ID is that number + 1.
Known duplicate IDs: Migrations 116 and 133 have duplicates — be aware of this but it only matters if creating migrations in that range (you won't be).
Create: src/infrastructure/database/migrations/<ID>_$ARGUMENTS.sql
Example: If the highest migration is 226_add_user_quota.sql and the user wants "add_status_to_contacts", create 227_add_status_to_contacts.sql.
All migrations 206+ MUST be safe and idempotent. Use these patterns:
-- For new tables:
CREATE TABLE IF NOT EXISTS table_name (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- For new columns:
ALTER TABLE table_name ADD COLUMN IF NOT EXISTS column_name VARCHAR(100);
-- For indexes:
CREATE INDEX IF NOT EXISTS idx_table_column ON table_name(column_name);
-- For constraints:
DO $$ BEGIN
ALTER TABLE table_name ADD CONSTRAINT constraint_name UNIQUE (col1, col2);
EXCEPTION WHEN duplicate_object THEN NULL;
END $$;
Open scripts/migrate.js and add the new migration filename to the SAFE_MIGRATIONS array at the end.
IF NOT EXISTS / IF EXISTS for idempotencyuser_id references where applicable (multi-tenant)TIMESTAMPTZ for timestamps, not TIMESTAMPgen_random_uuid() for UUID defaultsON DELETE CASCADE for foreign keys to users(id)