Skip to content

Commit 8abea4f

Browse files
authored
(claude) Add Testerson1 test table and improve migration workflow (#62)
1 parent 273fc91 commit 8abea4f

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

CLAUDE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ Follow the project's `.cursorrules` for consistent development:
100100
- Store raw API responses with metadata (marketId, eventId, apiEndpoint, responseStatus, fetchedAt)
101101
- **Prefer simple queries** - Complex joins can be hard to debug for a solo developer
102102

103+
### Database Migrations
104+
- Use `pnpm run db:migrate:dev` for development migrations
105+
- Use `pnpm run db:migrate:deploy` for production deployments
106+
- Use `pnpm run db:migrate:status` to check migration status
107+
- **Migration naming**: Provide `--name descriptive_name` to avoid interactive prompts
108+
- **Example**: `pnpm run db:migrate:dev --name add_user_table`
109+
- Always test migrations in development before deploying to production
110+
103111
### Security Best Practices
104112
- Validate all user inputs
105113
- Use environment variables for sensitive data (in `.env.local`, not `.env`)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- CreateTable
2+
CREATE TABLE "public"."testerson1" (
3+
"id" TEXT NOT NULL,
4+
"name" TEXT NOT NULL,
5+
"description" TEXT,
6+
"is_active" BOOLEAN NOT NULL DEFAULT true,
7+
"count" INTEGER NOT NULL DEFAULT 0,
8+
"created_at" TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
9+
"updated_at" TIMESTAMP(6) NOT NULL,
10+
11+
CONSTRAINT "testerson1_pkey" PRIMARY KEY ("id")
12+
);
13+
14+
-- CreateIndex
15+
CREATE INDEX "idx_testerson1_name" ON "public"."testerson1"("name");
16+
17+
-- CreateIndex
18+
CREATE INDEX "idx_testerson1_is_active" ON "public"."testerson1"("is_active");

prisma/schema.prisma

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,20 @@ model UserWatchlist {
204204
@@map("user_watchlist")
205205
}
206206

207+
model Testerson1 {
208+
id String @id @default(cuid())
209+
name String
210+
description String?
211+
isActive Boolean @default(true) @map("is_active")
212+
count Int @default(0)
213+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
214+
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamp(6)
215+
216+
@@index([name], map: "idx_testerson1_name")
217+
@@index([isActive], map: "idx_testerson1_is_active")
218+
@@map("testerson1")
219+
}
220+
207221
enum Category {
208222
ELECTIONS @map("elections")
209223
GEOPOLITICS @map("geopolitics")

0 commit comments

Comments
 (0)