feat: normalize catalog tables and current character assets
This commit is contained in:
+34
-7
@@ -7,6 +7,7 @@ import {
|
||||
jsonb,
|
||||
numeric,
|
||||
pgSchema,
|
||||
pgTable,
|
||||
primaryKey,
|
||||
text,
|
||||
timestamp,
|
||||
@@ -22,7 +23,6 @@ const mediaSchema = pgSchema("media");
|
||||
const editorSchema = pgSchema("editor");
|
||||
const catalogSchema = pgSchema("catalog");
|
||||
const guidesSchema = pgSchema("guides");
|
||||
const operationsSchema = pgSchema("operations");
|
||||
|
||||
const timestamps = {
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
@@ -401,7 +401,7 @@ export const mediaReferences = mediaSchema.table(
|
||||
],
|
||||
);
|
||||
|
||||
export const outboxEvents = operationsSchema.table(
|
||||
export const outboxEvents = pgTable(
|
||||
"outbox_event",
|
||||
{
|
||||
id: bigint("id", { mode: "number" })
|
||||
@@ -432,7 +432,7 @@ export const outboxEvents = operationsSchema.table(
|
||||
);
|
||||
|
||||
export const catalogVersions = catalogSchema.table(
|
||||
"catalog_version",
|
||||
"version",
|
||||
{
|
||||
version: varchar("version", { length: 32 }).primaryKey(),
|
||||
active: boolean("active").default(false).notNull(),
|
||||
@@ -443,7 +443,7 @@ export const catalogVersions = catalogSchema.table(
|
||||
);
|
||||
|
||||
export const catalogCharacters = catalogSchema.table(
|
||||
"catalog_character",
|
||||
"character",
|
||||
{
|
||||
version: varchar("version", { length: 32 })
|
||||
.notNull()
|
||||
@@ -466,8 +466,35 @@ export const catalogCharacters = catalogSchema.table(
|
||||
],
|
||||
);
|
||||
|
||||
export const catalogCharacterCurrent = catalogSchema.table(
|
||||
"character_current",
|
||||
{
|
||||
key: varchar("key", { length: 64 }).notNull(),
|
||||
name: text("name").notNull(),
|
||||
element: varchar("element", { length: 48 }),
|
||||
rarity: integer("rarity"),
|
||||
weaponType: varchar("weapon_type", { length: 64 }),
|
||||
imageKey: text("image_key").notNull(),
|
||||
elementIconKey: text("element_icon_key"),
|
||||
splashImageKey: text("splash_image_key"),
|
||||
nameCardImageKey: text("name_card_image_key"),
|
||||
constellations: jsonb("constellations")
|
||||
.$type<CatalogConstellation[]>()
|
||||
.default([])
|
||||
.notNull(),
|
||||
talents: jsonb("talents")
|
||||
.$type<CatalogTalent[]>()
|
||||
.default([])
|
||||
.notNull(),
|
||||
},
|
||||
(table) => [
|
||||
primaryKey({ columns: [table.key] }),
|
||||
index("catalog_character_current_name_idx").on(table.name),
|
||||
],
|
||||
);
|
||||
|
||||
export const catalogWeapons = catalogSchema.table(
|
||||
"catalog_weapon",
|
||||
"weapon",
|
||||
{
|
||||
version: varchar("version", { length: 32 })
|
||||
.notNull()
|
||||
@@ -485,7 +512,7 @@ export const catalogWeapons = catalogSchema.table(
|
||||
);
|
||||
|
||||
export const catalogArtifacts = catalogSchema.table(
|
||||
"catalog_artifact",
|
||||
"artifact",
|
||||
{
|
||||
version: varchar("version", { length: 32 })
|
||||
.notNull()
|
||||
@@ -502,7 +529,7 @@ export const catalogArtifacts = catalogSchema.table(
|
||||
);
|
||||
|
||||
export const catalogSyncJobs = catalogSchema.table(
|
||||
"catalog_sync_job",
|
||||
"sync_job",
|
||||
{
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
status: varchar("status", { length: 24 }).default("pending").notNull(),
|
||||
|
||||
Reference in New Issue
Block a user