CREATE SCHEMA "web";
--> statement-breakpoint
CREATE TABLE "web"."password_reset_session" (
	"id" text PRIMARY KEY NOT NULL,
	"user_id" integer NOT NULL,
	"email" text NOT NULL,
	"code" text NOT NULL,
	"expires_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "web"."session" (
	"id" text PRIMARY KEY NOT NULL,
	"user_id" integer NOT NULL,
	"ip" varchar(16) DEFAULT '0.0.0.0' NOT NULL,
	"expires_at" timestamp NOT NULL
);
--> statement-breakpoint
ALTER TABLE "account"."account" ALTER COLUMN "email" SET DATA TYPE text;--> statement-breakpoint
ALTER TABLE "account"."account" ALTER COLUMN "ip" SET DATA TYPE varchar(16);--> statement-breakpoint
ALTER TABLE "log"."change_name" ALTER COLUMN "ip" SET DATA TYPE varchar(16);--> statement-breakpoint
ALTER TABLE "log"."command_log" ALTER COLUMN "ip" SET DATA TYPE varchar(16);--> statement-breakpoint
ALTER TABLE "log"."log" ALTER COLUMN "ip" SET DATA TYPE varchar(16);--> statement-breakpoint
ALTER TABLE "player"."player" ALTER COLUMN "ip" SET DATA TYPE varchar(16);--> statement-breakpoint
ALTER TABLE "player"."player_deleted" ALTER COLUMN "ip" SET DATA TYPE varchar(16);--> statement-breakpoint
ALTER TABLE "web"."password_reset_session" ADD CONSTRAINT "password_reset_session_user_id_account_id_fk" FOREIGN KEY ("user_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "web"."session" ADD CONSTRAINT "session_user_id_account_id_fk" FOREIGN KEY ("user_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."item_attr_rare" ALTER COLUMN "apply" SET DATA TYPE text;--> statement-breakpoint
DROP TYPE "player"."item_attr_rare_apply";--> statement-breakpoint
CREATE TYPE "player"."item_attr_rare_apply" AS ENUM('MAX_HP', 'MAX_SP', 'CON', 'INT', 'STR', 'DEX', 'ATT_SPEED', 'MOV_SPEED', 'CAST_SPEED', 'HP_REGEN', 'SP_REGEN', 'POISON_PCT', 'STUN_PCT', 'SLOW_PCT', 'CRITICAL_PCT', 'PENETRATE_PCT', 'ATTBONUS_HUMAN', 'ATTBONUS_ANIMAL', 'ATTBONUS_ORC', 'ATTBONUS_MILGYO', 'ATTBONUS_UNDEAD', 'ATTBONUS_DEVIL', 'STEAL_HP', 'STEAL_SP', 'MANA_BURN_PCT', 'DAMAGE_SP_RECOVER', 'BLOCK', 'DODGE', 'RESIST_SWORD', 'RESIST_TWOHAND', 'RESIST_DAGGER', 'RESIST_BELL', 'RESIST_FAN', 'RESIST_BOW', 'RESIST_FIRE', 'RESIST_ELEC', 'RESIST_MAGIC', 'RESIST_WIND', 'REFLECT_MELEE', 'REFLECT_CURSE', 'POISON_REDUCE', 'KILL_SP_RECOVER', 'EXP_DOUBLE_BONUS', 'GOLD_DOUBLE_BONUS', 'ITEM_DROP_BONUS', 'POTION_BONUS', 'KILL_HP_RECOVER', 'IMMUNE_STUN', 'IMMUNE_SLOW', 'IMMUNE_FALL', 'SKILL', 'BOW_DISTANCE', 'ATT_GRADE_BONUS', 'DEF_GRADE_BONUS', 'MAGIC_ATT_GRADE', 'MAGIC_DEF_GRADE', 'CURSE_PCT', 'MAX_STAMINA', 'ATT_BONUS_TO_WARRIOR', 'ATT_BONUS_TO_ASSASSIN', 'ATT_BONUS_TO_SURA', 'ATT_BONUS_TO_SHAMAN', 'ATT_BONUS_TO_MONSTER', 'NORMAL_HIT_DEFEND_BONUS', 'SKILL_DEFEND_BONUS', 'NOUSE2', 'NOUSE3', 'NOUSE4', 'NOUSE5', 'NOUSE6', 'NOUSE7', 'NOUSE8', 'NOUSE9', 'NOUSE10', 'NOUSE11', 'NOUSE12', 'NOUSE13', 'NOUSE14', 'RESIST_WARRIOR', 'RESIST_ASSASSIN', 'RESIST_SURA', 'RESIST_SHAMAN');--> statement-breakpoint
ALTER TABLE "player"."item_attr_rare" ALTER COLUMN "apply" SET DATA TYPE "player"."item_attr_rare_apply" USING "apply"::"player"."item_attr_rare_apply";