61 lines
1.6 KiB
SQL
61 lines
1.6 KiB
SQL
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";
|