Skip to content

Instantly share code, notes, and snippets.

@tkgstrator
Created July 21, 2023 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkgstrator/64eb2f0ed86d2e90707d54950de34ac4 to your computer and use it in GitHub Desktop.
Save tkgstrator/64eb2f0ed86d2e90707d54950de34ac4 to your computer and use it in GitHub Desktop.
Prisma
enum Rule {
REGULAR
BIG_RUN
TEAM_CONTEST
}
enum Mode {
REGULAR
LIMITED
PRIVATE_CUSTOM
PRIVATE_SCENARIO
}
enum Species {
INKLING
OCTOLING
}
enum Client {
SALMONIA
SALMDROID
}
model Schedule {
scheduleId String @id @default(uuid()) @map("schedule_id") @db.Uuid
// 開始時刻
startTime DateTime @default("1970-01-01T00:00:00Z") @map("start_time") @db.Timestamp(0)
// 終了時刻
endTime DateTime @default("1970-01-01T00:00:00Z") @map("end_time") @db.Timestamp(0)
// ステージID
stageId Int @map("stage_id") @db.SmallInt
// 支給ブキID
weaponList Int[] @map("weapon_list")
// モード
mode Mode @default(REGULAR)
// ルール
rule Rule @default(REGULAR)
// レアブキ
rareWeapon Int? @map("rare_weapon") @db.SmallInt
// オカシラシャケのID
bossId Int? @map("boss_id") @db.SmallInt
// 作成日
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(0)
// 更新日
updatedAt DateTime @updatedAt() @map("updated_at") @db.Timestamp(0)
// リザルト一覧
results Result[]
@@unique([stageId, mode, rule, weaponList, startTime, endTime], name: "unique")
@@unique([scheduleId])
@@index([stageId])
@@index([rule])
@@index([mode])
@@index([rule, mode])
@@map("schedules")
}
model Result {
// バイトID
id String @map("id") @db.Uuid
// スケジュールID
scheduleId String @map("schedule_id") @db.Uuid
// プレイ時刻
playTime DateTime @map("play_time") @db.Timestamp(0)
// オオモノ出現数
bossCounts Int[] @map("boss_counts") @db.SmallInt
// オオモノ討伐数
bossKillCounts Int[] @map("boss_kill_counts") @db.SmallInt
// イクラ数
ikuraNum Int @map("ikura_num") @db.SmallInt
// 金イクラ数
goldenIkuraNum Int @map("golden_ikura_num") @db.SmallInt
// 金イクラ数
goldenIkuraAssistNum Int @map("golden_ikura_assist_num") @db.SmallInt
// 夜イベントを含むかどうか
nightLess Boolean @map("night_less") @db.Boolean
// キケン度
dangerRate Decimal @map("danger_rate") @db.Decimal(4, 3)
// プレイヤーのID配列(ソート済み)
members String[] @db.VarChar(20)
// ドウウロコの枚数
bronze Int? @db.SmallInt
// ギンウロコの枚数
silver Int? @db.SmallInt
// キンウロコの枚数
gold Int? @db.SmallInt
// クリアしたかどうか
isClear Boolean @map("is_clear") @db.Boolean
// 失敗したWAVE
failureWave Int? @map("failure_wave") @db.SmallInt
// オカシラシャケを討伐したかどうか
isBossDefeated Boolean? @map("is_boss_defeated") @db.Boolean
// たおしたオカシラシャケのID
// 不要かもしれないが残しておく
bossId Int? @map("boss_id") @db.SmallInt
// シナリオコード
scenarioCode String? @map("scenario_code") @db.VarChar(16)
// 作成日
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(0)
// 更新日
updatedAt DateTime @updatedAt() @map("updated_at") @db.Timestamp(0)
// アップロードしたクライアント
createdBy Client @default(SALMONIA) @map("updated_by")
// アップロードしたクライアントバージョン
version String @db.VarChar(16)
waves Wave[]
players Player[]
schedule Schedule? @relation(fields: [scheduleId], references: [scheduleId])
@@id([id, playTime])
@@unique([id, scheduleId, playTime])
@@index([members])
@@index([goldenIkuraNum, nightLess])
@@index([scheduleId])
@@index([scenarioCode])
@@index([dangerRate])
@@map("results")
}
model Player {
// リザルトID
id String @map("id") @db.Uuid
// スケジュールID
scheduleId String @map("schedule_id") @db.Uuid
// 遊んだ時間
playTime DateTime @map("play_time") @db.Timestamp(0)
// プレイヤーID
nplnUserId String @map("npln_user_id") @db.VarChar(20)
// 名前
name String @db.VarChar(32)
// 称号
byname String @db.VarChar(64)
// 名前ID
nameId String @map("name_id") @db.VarChar(8)
// バッジ
badges Int[] @db.Integer
// ネームプレート
nameplate Int @db.SmallInt
// ネームプレート
textColor Float[] @map("text_color") @db.DoublePrecision
// ユニフォーム
uniform Int @db.SmallInt
// オオモノ討伐数合計
bossKillCountsTotal Int @map("boss_kill_counts_total") @db.SmallInt
// オオモノ討伐数
bossKillCounts Int[] @map("boss_kill_counts") @db.SmallInt
// 被救助数
deadCount Int @map("dead_count") @db.SmallInt
// 救助数
helpCount Int @map("help_count") @db.SmallInt
// イクラ数
ikuraNum Int @map("ikura_num") @db.SmallInt
// 金イクラ数
goldenIkuraNum Int @map("golden_ikura_num") @db.SmallInt
// 金イクラアシスト数
goldenIkuraAssistNum Int @map("golden_ikura_assist_num") @db.SmallInt
// バイトボーナス
jobBonus Int? @map("job_bonus") @db.SmallInt
// バイトレート
jobRate Float? @map("job_rate") @db.Real
// バイトスコア
jobScore Int? @map("job_score") @db.SmallInt
// クマサンポイント
kumaPoint Int? @map("kuma_point") @db.SmallInt
// 称号
gradeId Int? @map("grade_id") @db.SmallInt
// 評価レート
gradePoint Int? @map("grade_point") @db.SmallInt
// オカシラメーター
smellMeter Int? @map("smell_meter") @db.SmallInt
// 種族
species Species @default(INKLING)
// スペシャルID
specialId Int? @map("special_id") @db.SmallInt
// スペシャル使用数
specialCounts Int[] @map("special_count") @db.SmallInt
// 支給されたブキのリスト
weaponList Int[] @map("weapon_list") @db.SmallInt
// 作成日
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(0)
// 更新日
updatedAt DateTime @updatedAt() @map("updated_at") @db.Timestamp(0)
// リレーション
result Result? @relation(fields: [id, scheduleId, playTime], references: [id, scheduleId, playTime])
@@id([nplnUserId, playTime])
@@unique([nplnUserId, playTime, id])
@@index([nplnUserId])
@@index([scheduleId])
@@index([name])
@@index([gradePoint])
@@map("players")
}
model Wave {
// リザルトID
id String @map("id") @db.Uuid
// スケジュールID
scheduleId String @map("schedule_id") @db.Uuid
// プレイ時間
playTime DateTime @map("play_time") @db.Timestamp(0)
// WAVE数
waveId Int @map("wave_id") @db.SmallInt
// 潮位
waterLevel Int @map("water_level") @db.SmallInt
// イベント
eventType Int @map("event_type") @db.SmallInt
// 金イクラ数
goldenIkuraNum Int? @map("golden_ikura_num") @db.SmallInt
// 金イクラドロップ数
goldenIkuraPopNum Int @map("golden_ikura_pop_num") @db.SmallInt
// 金イクラドロップ数
quotaNum Int? @map("quota_num") @db.SmallInt
// クリアしたか
isClear Boolean @map("is_clear") @db.Boolean
// 作成日
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(0)
// 更新日
updatedAt DateTime @updatedAt() @map("updated_at") @db.Timestamp(0)
result Result? @relation(fields: [id, scheduleId, playTime], references: [id, scheduleId, playTime])
@@id([id, waveId, playTime])
@@index([scheduleId])
@@index([waterLevel])
@@index([eventType])
@@index([waterLevel, eventType])
@@index([goldenIkuraNum])
@@map("waves")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment