-- AlterTable: how many ladder rungs a weapon climbs per level (1 standard, 2 powerful, 3 legendary) ALTER TABLE "weapons" ADD COLUMN "damageScaling" INTEGER NOT NULL DEFAULT 1; -- AlterTable: the level of the copy a character holds ALTER TABLE "character_weapons" ADD COLUMN "level" INTEGER NOT NULL DEFAULT 1; -- AlterTable: items can optionally carry dice (damage, healing, ...) that scale the same way ALTER TABLE "items" ADD COLUMN "damageDice" TEXT, ADD COLUMN "damageScaling" INTEGER NOT NULL DEFAULT 1; -- AlterTable ALTER TABLE "inventory_items" ADD COLUMN "level" INTEGER NOT NULL DEFAULT 1; -- AlterTable: spells get a fixed damage value; their classic level is the requirement ALTER TABLE "spells" ADD COLUMN "damageDice" TEXT; -- A spell above its holder's level can no longer be prepared. UPDATE "character_spells" cs SET "prepared" = false FROM "spells" s, "characters" c WHERE s."id" = cs."spellId" AND c."id" = cs."characterId" AND s."level" > c."level";