Skip to content

Commit

Permalink
feat: initial migration
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftpsh committed Mar 15, 2024
1 parent 9f3baab commit 9b84ab7
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
run: |
touch ./src/config.ts
echo "${{ secrets.SERVER_CONFIG }}" >> ./src/config.ts
touch ./prisma/.env
echo '${{ secrets.SERVER_PRISMA_ENV }}' >> ./prisma/.env
touch ./src/prisma/.env
echo '${{ secrets.SERVER_PRISMA_ENV }}' >> ./src/prisma/.env
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand Down
54 changes: 54 additions & 0 deletions src/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}

enum GameType {
P4_TOUPUUSEN
P3_TOUPUUSEN
P4_HANCHAN
P3_HANCHAN
}

enum Wind {
EAST
SOUTH
WEST
NORTH
}

model User {
userId Int @id @default(autoincrement())
displayName String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userScores UserScore[]
}

model GameRecord {
gameId Int @id @default(autoincrement())
gameType GameType
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userScores UserScore[]
}

model UserScore {
userScoreId Int @id @default(autoincrement())
userId Int
gameId Int
initialSeat Wind
score Int
rank Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [userId])
gameRecord GameRecord @relation(fields: [gameId], references: [gameId])
}

0 comments on commit 9b84ab7

Please sign in to comment.