Files
CASAN/AINative_OKR_CASAN5/backend/prisma/schema.prisma
T
thanhnvandClaude Sonnet 4.6 9229fee656 feat(deploy): switch to Oracle MySQL, separate CI runner, docker-compose deploy
- Prisma schema: sqlite → mysql provider
- Migration SQL rewritten as MySQL DDL (utf8mb4, DATETIME(3), AUTO_INCREMENT)
- Add migration_lock.toml for mysql provider
- Dockerfile.backend: drop node:22/sqlite deps, use node:20-slim
- entrypoint.sh: replace SQLite first-run logic with prisma migrate deploy + db seed
- docker-compose.prod.yml: production compose for /opt/webapps/okr on web VPS
  - reads DB creds from /opt/webapps/webapp-mysql.env
  - reads app secrets from /opt/webapps/okr/.env.app (written by CI)
  - port 80 (frontend), no conflict with Gitea 3000/Vault 8200
- ci.yml deploy-okr: moves from ubuntu-latest (web VPS) to ci-runner (161.33.149.243)
  - builds images on CI runner VPS (no heavy build on web/Gitea VPS)
  - transfers images via docker save | gzip | ssh | docker load
  - deploys via SSH + docker compose up on web VPS
- scripts/setup-ci-runner.sh: one-time setup script for CI runner VPS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 16:37:56 +09:00

64 lines
1.6 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
name String
username String @unique
email String @unique
passwordHash String
role String
objectives Objective[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Objective {
id Int @id @default(autoincrement())
title String
description String?
ownerId Int
owner User @relation(fields: [ownerId], references: [id])
quarter String
status String @default("NOT_STARTED")
keyResults KeyResult[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([ownerId])
@@index([quarter])
@@index([status])
}
model KeyResult {
id Int @id @default(autoincrement())
objectiveId Int
objective Objective @relation(fields: [objectiveId], references: [id], onDelete: Cascade)
title String
progress Int @default(0)
startValue Int
targetValue Int
deadline DateTime
updates ProgressUpdate[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([objectiveId])
}
model ProgressUpdate {
id Int @id @default(autoincrement())
keyResultId Int
keyResult KeyResult @relation(fields: [keyResultId], references: [id], onDelete: Cascade)
progress Int
comment String?
createdById Int
createdAt DateTime @default(now())
}