一键导入
prisma-migration
Create a Prisma migration file for schema changes. Required for production — db push only works in dev. Use after modifying schema.prisma.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a Prisma migration file for schema changes. Required for production — db push only works in dev. Use after modifying schema.prisma.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Launch, build, run, start, screenshot, or smoke-test the Librariarr Next.js webapp end-to-end. Use when asked to run librariarr, bring up the dev stack, take a screenshot of the dashboard or any UI page, verify a change in the running app, or check that the app boots cleanly.
Generate a new Next.js API route with project boilerplate (auth, validation, sanitize, Prisma). Use when creating new API endpoints.
Generate an integration test for an API route with all required mocks and boilerplate. Use when creating tests for API endpoints.
Quick reference for all Librariarr project conventions and patterns. Consult when writing or reviewing code to verify correct patterns.
Scaffold a complete new feature end-to-end (Prisma model, migration, schemas, API routes, tests). Use for new CRUD resources or features that span multiple layers.
Add a new Zod validation schema to src/lib/validation.ts. All schemas MUST live in this file using zod/v4. Use when creating validation for new API endpoints.
| name | prisma-migration |
| description | Create a Prisma migration file for schema changes. Required for production — db push only works in dev. Use after modifying schema.prisma. |
| argument-hint | <migration-name> |
Create a migration for: $ARGUMENTS
prisma migrate deploy which ONLY applies migration filesprisma db push (no migration files needed for iteration)prisma/migrations/NNNN_description/migration.sql
Check prisma/migrations/ for the latest number and increment by 1.
Add column:
ALTER TABLE "TableName" ADD COLUMN "columnName" TEXT;
Add column with default:
ALTER TABLE "TableName" ADD COLUMN "columnName" BOOLEAN NOT NULL DEFAULT false;
Add array column (PostgreSQL):
ALTER TABLE "TableName" ADD COLUMN "columnName" TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[];
Add index:
CREATE INDEX "TableName_columnName_idx" ON "TableName"("columnName");
Add unique constraint:
ALTER TABLE "TableName" ADD CONSTRAINT "TableName_columnName_key" UNIQUE ("columnName");
Create new table:
The project's models use id String @id @default(cuid()) — cuids are generated
app-side by Prisma, so the id column has NO database-level default (do NOT use
gen_random_uuid(); no existing migration does). This matches every table in
0001_init.
CREATE TABLE "TableName" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"name" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "TableName_pkey" PRIMARY KEY ("id")
);
CREATE INDEX "TableName_userId_idx" ON "TableName"("userId");
ALTER TABLE "TableName" ADD CONSTRAINT "TableName_userId_fkey"
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Create enum:
CREATE TYPE "EnumName" AS ENUM ('VALUE1', 'VALUE2');
Add enum value:
ALTER TYPE "EnumName" ADD VALUE 'NEW_VALUE';
Drop column:
ALTER TABLE "TableName" DROP COLUMN "columnName";
prisma/migrations/ to determine the next migration numberprisma/schema.prisma with the schema changesprisma/migrations/NNNN_$ARGUMENTS/migration.sql with the SQLpnpm docker:dev:db:push
DATABASE_URL="postgresql://librariarr:librariarr@localhost:5432/librariarr" pnpm exec prisma migrate resolve --applied NNNN_$ARGUMENTS
DATABASE_URL="postgresql://librariarr:librariarr@localhost:5432/librariarr" pnpm exec prisma migrate status
Should show "Database schema is up to date!"pnpm exec prisma generatedeleteMany() call to tests/setup/test-db.ts cleanDatabase() in correct dependency ordersrc/lib/backup/backup-service.tstests/setup/test-helpers.ts