feat: 외교부 기능 추가 및 외교 문서 관련 데이터베이스 모델 생성
This commit is contained in:
@@ -37,6 +37,13 @@ enum AuctionType {
|
||||
UNIQUE_ITEM
|
||||
}
|
||||
|
||||
enum DiplomacyLetterState {
|
||||
PROPOSED
|
||||
ACTIVATED
|
||||
CANCELLED
|
||||
REPLACED
|
||||
}
|
||||
|
||||
model WorldState {
|
||||
id Int @id @default(autoincrement())
|
||||
scenarioCode String @map("scenario_code")
|
||||
@@ -187,6 +194,25 @@ model Diplomacy {
|
||||
@@map("diplomacy")
|
||||
}
|
||||
|
||||
model DiplomacyLetter {
|
||||
id Int @id @default(autoincrement())
|
||||
srcNationId Int @map("src_nation_id")
|
||||
destNationId Int @map("dest_nation_id")
|
||||
prevId Int? @map("prev_id")
|
||||
state DiplomacyLetterState @default(PROPOSED)
|
||||
textBrief String @map("text_brief")
|
||||
textDetail String @map("text_detail")
|
||||
date DateTime @default(now()) @map("date")
|
||||
srcSignerId Int @map("src_signer")
|
||||
destSignerId Int? @map("dest_signer")
|
||||
aux Json @default(dbgenerated("'{}'::jsonb"))
|
||||
|
||||
@@index([srcNationId, destNationId])
|
||||
@@index([destNationId, srcNationId])
|
||||
@@index([state, date])
|
||||
@@map("diplomacy_letter")
|
||||
}
|
||||
|
||||
model Event {
|
||||
id Int @id @default(autoincrement())
|
||||
targetCode String @map("target_code")
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
CREATE TYPE "diplomacy_letter_state" AS ENUM ('PROPOSED', 'ACTIVATED', 'CANCELLED', 'REPLACED');
|
||||
|
||||
CREATE TABLE "diplomacy_letter" (
|
||||
"id" SERIAL PRIMARY KEY,
|
||||
"src_nation_id" INTEGER NOT NULL,
|
||||
"dest_nation_id" INTEGER NOT NULL,
|
||||
"prev_id" INTEGER,
|
||||
"state" "diplomacy_letter_state" NOT NULL DEFAULT 'PROPOSED',
|
||||
"text_brief" TEXT NOT NULL,
|
||||
"text_detail" TEXT NOT NULL,
|
||||
"date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"src_signer" INTEGER NOT NULL,
|
||||
"dest_signer" INTEGER,
|
||||
"aux" JSONB NOT NULL DEFAULT '{}'::jsonb
|
||||
);
|
||||
|
||||
CREATE INDEX "diplomacy_letter_src_dest_idx" ON "diplomacy_letter"("src_nation_id", "dest_nation_id");
|
||||
CREATE INDEX "diplomacy_letter_dest_src_idx" ON "diplomacy_letter"("dest_nation_id", "src_nation_id");
|
||||
CREATE INDEX "diplomacy_letter_state_date_idx" ON "diplomacy_letter"("state", "date");
|
||||
@@ -9,6 +9,7 @@ export interface DatabaseClient {
|
||||
city: GamePrisma.CityDelegate;
|
||||
nation: GamePrisma.NationDelegate;
|
||||
diplomacy: GamePrisma.DiplomacyDelegate;
|
||||
diplomacyLetter: GamePrisma.DiplomacyLetterDelegate;
|
||||
generalTurn: GamePrisma.GeneralTurnDelegate;
|
||||
nationTurn: GamePrisma.NationTurnDelegate;
|
||||
troop: GamePrisma.TroopDelegate;
|
||||
|
||||
Reference in New Issue
Block a user