feat: NPC와 국방 정책 변경을 감사 버전으로 저장
This commit is contained in:
@@ -1138,3 +1138,30 @@ model PlayAuditGeneral {
|
||||
@@index([sampleId, cityId, generalId])
|
||||
@@map("play_audit_general")
|
||||
}
|
||||
|
||||
// 현재 기수의 불변 정책 버전. live nation 삭제와 수명을 분리한다.
|
||||
model PlayAuditPolicy {
|
||||
schemaVersion Int @default(1) @map("schema_version")
|
||||
id String @id
|
||||
serverId String @map("server_id")
|
||||
nationId Int @map("nation_id")
|
||||
area String
|
||||
revision Int
|
||||
previousId String? @map("previous_id")
|
||||
source String
|
||||
year Int
|
||||
month Int
|
||||
tick Int?
|
||||
requestId String? @map("request_id")
|
||||
inputSequence BigInt? @map("input_sequence")
|
||||
ordinal Int
|
||||
actor Json?
|
||||
before Json?
|
||||
after Json
|
||||
hash String
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
||||
|
||||
@@unique([serverId, nationId, area, revision])
|
||||
@@index([serverId, nationId, year, month, ordinal])
|
||||
@@map("play_audit_policy")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
CREATE TABLE "play_audit_policy" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"server_id" TEXT NOT NULL,
|
||||
"nation_id" INTEGER NOT NULL,
|
||||
"area" TEXT NOT NULL CHECK ("area" IN ('NPC_VALUES', 'NPC_NATION_PRIORITY', 'NPC_GENERAL_PRIORITY', 'DEFENCE')),
|
||||
"revision" INTEGER NOT NULL CHECK ("revision" > 0),
|
||||
"previous_id" TEXT,
|
||||
"source" TEXT NOT NULL CHECK ("source" IN ('BASELINE', 'CHANGE', 'OBSERVED_GAP')),
|
||||
"year" INTEGER NOT NULL,
|
||||
"month" INTEGER NOT NULL CHECK ("month" BETWEEN 1 AND 12),
|
||||
"tick" INTEGER,
|
||||
"request_id" TEXT,
|
||||
"input_sequence" BIGINT,
|
||||
"ordinal" INTEGER NOT NULL,
|
||||
"actor" JSONB,
|
||||
"before" JSONB,
|
||||
"after" JSONB NOT NULL,
|
||||
"hash" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE UNIQUE INDEX "play_audit_policy_server_id_nation_id_area_revision_key" ON "play_audit_policy" ("server_id", "nation_id", "area", "revision");
|
||||
CREATE INDEX "play_audit_policy_server_id_nation_id_year_month_ordinal_idx" ON "play_audit_policy" ("server_id", "nation_id", "year", "month", "ordinal");
|
||||
+1
@@ -0,0 +1 @@
|
||||
ALTER TABLE "play_audit_policy" ADD COLUMN "schema_version" INTEGER NOT NULL DEFAULT 1 CHECK ("schema_version" > 0);
|
||||
Reference in New Issue
Block a user