feat: normalize catalog tables and current character assets
CI / Verify (push) Successful in 1m12s
CI / Build immutable images and deploy (push) Successful in 1m17s

This commit is contained in:
2026-08-31 22:46:06 +07:00 Unverified
parent 83f9c07156
commit 737b54bff8
11 changed files with 7846 additions and 157 deletions
+60
View File
@@ -0,0 +1,60 @@
CREATE TABLE "catalog"."catalog_character_current" (
"key" varchar(64) NOT NULL,
"name" text NOT NULL,
"element" varchar(48),
"rarity" integer,
"weapon_type" varchar(64),
"image_key" text NOT NULL,
"element_icon_key" text,
"splash_image_key" text,
"name_card_image_key" text,
"constellations" jsonb DEFAULT '[]'::jsonb NOT NULL,
"talents" jsonb DEFAULT '[]'::jsonb NOT NULL,
CONSTRAINT "catalog_character_current_key_pk" PRIMARY KEY("key")
);
--> statement-breakpoint
CREATE INDEX "catalog_character_current_name_idx" ON "catalog"."catalog_character_current" USING btree ("name");
--> statement-breakpoint
INSERT INTO "catalog"."catalog_character_current" (
"key",
"name",
"element",
"rarity",
"weapon_type",
"image_key",
"element_icon_key",
"splash_image_key",
"name_card_image_key",
"constellations",
"talents"
)
SELECT
"key",
"name",
"element",
"rarity",
"weapon_type",
"image_key",
"element_icon_key",
"coop_image_key",
"name_card_image_key",
"constellations",
"talents"
FROM "catalog"."catalog_character"
WHERE "version" = (
SELECT "version"
FROM "catalog"."catalog_version"
WHERE "active" = true
LIMIT 1
)
ON CONFLICT ("key") DO UPDATE SET
"name" = excluded."name",
"element" = excluded."element",
"rarity" = excluded."rarity",
"weapon_type" = excluded."weapon_type",
"image_key" = excluded."image_key",
"element_icon_key" = excluded."element_icon_key",
"splash_image_key" = excluded."splash_image_key",
"name_card_image_key" = excluded."name_card_image_key",
"constellations" = excluded."constellations",
"talents" = excluded."talents";
+36
View File
@@ -0,0 +1,36 @@
ALTER TABLE "operations"."outbox_event" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
ALTER TABLE "operations"."outbox_event" SET SCHEMA "public";
--> statement-breakpoint
DROP SCHEMA IF EXISTS "operations";
--> statement-breakpoint
ALTER TABLE "catalog"."catalog_artifact" RENAME TO "artifact";--> statement-breakpoint
ALTER TABLE "catalog"."catalog_character_current" RENAME TO "character_current";--> statement-breakpoint
ALTER TABLE "catalog"."catalog_character" RENAME TO "character";--> statement-breakpoint
ALTER TABLE "catalog"."catalog_sync_job" RENAME TO "sync_job";--> statement-breakpoint
ALTER TABLE "catalog"."catalog_version" RENAME TO "version";--> statement-breakpoint
ALTER TABLE "catalog"."catalog_weapon" RENAME TO "weapon";--> statement-breakpoint
ALTER TABLE "catalog"."artifact" DROP CONSTRAINT "catalog_artifact_version_catalog_version_version_fk";
--> statement-breakpoint
ALTER TABLE "catalog"."character" DROP CONSTRAINT "catalog_character_version_catalog_version_version_fk";
--> statement-breakpoint
ALTER TABLE "catalog"."sync_job" DROP CONSTRAINT "catalog_sync_job_triggered_by_id_user_id_fk";
--> statement-breakpoint
ALTER TABLE "catalog"."weapon" DROP CONSTRAINT "catalog_weapon_version_catalog_version_version_fk";
--> statement-breakpoint
ALTER TABLE "guides"."guide" DROP CONSTRAINT "guide_catalog_version_catalog_version_version_fk";
--> statement-breakpoint
DROP INDEX "catalog"."catalog_active_unique";--> statement-breakpoint
ALTER TABLE "catalog"."artifact" DROP CONSTRAINT "catalog_artifact_version_key_pk";--> statement-breakpoint
ALTER TABLE "catalog"."character_current" DROP CONSTRAINT "catalog_character_current_key_pk";--> statement-breakpoint
ALTER TABLE "catalog"."character" DROP CONSTRAINT "catalog_character_version_key_pk";--> statement-breakpoint
ALTER TABLE "catalog"."weapon" DROP CONSTRAINT "catalog_weapon_version_key_pk";--> statement-breakpoint
ALTER TABLE "catalog"."artifact" ADD CONSTRAINT "artifact_version_key_pk" PRIMARY KEY("version","key");--> statement-breakpoint
ALTER TABLE "catalog"."character_current" ADD CONSTRAINT "character_current_key_pk" PRIMARY KEY("key");--> statement-breakpoint
ALTER TABLE "catalog"."character" ADD CONSTRAINT "character_version_key_pk" PRIMARY KEY("version","key");--> statement-breakpoint
ALTER TABLE "catalog"."weapon" ADD CONSTRAINT "weapon_version_key_pk" PRIMARY KEY("version","key");--> statement-breakpoint
ALTER TABLE "catalog"."artifact" ADD CONSTRAINT "artifact_version_version_version_fk" FOREIGN KEY ("version") REFERENCES "catalog"."version"("version") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "catalog"."character" ADD CONSTRAINT "character_version_version_version_fk" FOREIGN KEY ("version") REFERENCES "catalog"."version"("version") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "catalog"."sync_job" ADD CONSTRAINT "sync_job_triggered_by_id_user_id_fk" FOREIGN KEY ("triggered_by_id") REFERENCES "auth"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "catalog"."weapon" ADD CONSTRAINT "weapon_version_version_version_fk" FOREIGN KEY ("version") REFERENCES "catalog"."version"("version") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "guides"."guide" ADD CONSTRAINT "guide_catalog_version_version_version_fk" FOREIGN KEY ("catalog_version") REFERENCES "catalog"."version"("version") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "catalog_active_unique" ON "catalog"."version" USING btree ("active") WHERE "catalog"."version"."active" = true;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+14
View File
@@ -92,6 +92,20 @@
"when": 1788177201633,
"tag": "0012_left_bishop",
"breakpoints": true
},
{
"idx": 13,
"version": "7",
"when": 1788190692631,
"tag": "0013_clammy_mandrill",
"breakpoints": true
},
{
"idx": 14,
"version": "7",
"when": 1788190879635,
"tag": "0014_redundant_black_crow",
"breakpoints": true
}
]
}