summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/schema/consent.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/db/schema/consent.ts b/db/schema/consent.ts
index a02d5575..c67f4b7d 100644
--- a/db/schema/consent.ts
+++ b/db/schema/consent.ts
@@ -38,6 +38,7 @@ import { users } from "./users";
export const policyVersions = pgTable("policy_versions", {
id: integer("id").primaryKey().generatedAlwaysAsIdentity(),
policyType: policyTypeEnum("policy_type").notNull(),
+ locale: varchar("locale", { length: 10 }).notNull(), // ko, en
version: varchar("version", { length: 20 }).notNull(),
content: text("content").notNull(),
effectiveDate: timestamp("effective_date", { withTimezone: true }).notNull(),
@@ -47,12 +48,12 @@ import { users } from "./users";
.notNull(),
}, (table) => {
return {
- // 정책 타입과 버전의 유니크 조합
- policyVersionUniqueIdx: uniqueIndex("policy_versions_type_version_idx")
- .on(table.policyType, table.version),
- // 현재 버전 조회용 인덱스
+ // 정책 타입, locale, 버전의 유니크 조합
+ policyVersionUniqueIdx: uniqueIndex("policy_versions_type_locale_version_idx")
+ .on(table.policyType, table.locale, table.version),
+ // 현재 버전 조회용 인덱스 (locale 포함)
currentPolicyIdx: index("policy_versions_current_idx")
- .on(table.isCurrent),
+ .on(table.isCurrent, table.locale),
// 효력 발생일 인덱스
effectiveDateIdx: index("policy_versions_effective_date_idx")
.on(table.effectiveDate),