web.ts/drizzle/0001_init.sql
2025-06-05 01:08:50 +01:00

913 lines
48 KiB
SQL

CREATE SCHEMA "account";
--> statement-breakpoint
CREATE SCHEMA "common";
--> statement-breakpoint
CREATE SCHEMA "log";
--> statement-breakpoint
CREATE SCHEMA "player";
--> statement-breakpoint
CREATE TYPE "common"."gm_authority" AS ENUM('IMPLEMENTOR', 'HIGH_WIZARD', 'GOD', 'LOW_WIZARD', 'PLAYER');--> statement-breakpoint
CREATE TYPE "common"."spam_type" AS ENUM('GOOD', 'SPAM');--> statement-breakpoint
CREATE TYPE "log"."gold_log_how" AS ENUM('BUY', 'SELL', 'SHOP_SELL', 'SHOP_BUY', 'EXCHANGE_TAKE', 'EXCHANGE_GIVE', 'QUEST');--> statement-breakpoint
CREATE TYPE "log"."log_type" AS ENUM('ITEM', 'CHARACTER');--> statement-breakpoint
CREATE TYPE "log"."login_log_type" AS ENUM('LOGIN', 'LOGOUT');--> statement-breakpoint
CREATE TYPE "log"."money_log_type" AS ENUM('MONSTER', 'SHOP', 'REFINE', 'QUEST', 'GUILD', 'MISC', 'KILL', 'DROP');--> statement-breakpoint
CREATE TYPE "log"."refine_log_set_type" AS ENUM('SOCKET', 'POWER', 'ROD', 'GUILD', 'SCROLL', 'HYUNIRON', 'GOD_SCROLL', 'MUSIN_SCROLL');--> statement-breakpoint
CREATE TYPE "log"."reward_type" AS ENUM('EXP', 'ITEM');--> statement-breakpoint
CREATE TYPE "player"."guild_grade_auth" AS ENUM('ADD_MEMBER', 'REMOVE_MEMEBER', 'NOTICE', 'USE_SKILL');--> statement-breakpoint
CREATE TYPE "player"."item_proto_immune_flag" AS ENUM('PARA', 'CURSE', 'STUN', 'SLEEP', 'SLOW', 'POISON', 'TERROR');--> statement-breakpoint
CREATE TYPE "player"."item_attr_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', 'ATTBONUS_WARRIOR', 'ATTBONUS_ASSASSIN', 'ATTBONUS_SURA', 'ATTBONUS_SHAMAN', 'ATTBONUS_MONSTER', 'MALL_ATTBONUS', 'MALL_DEFBONUS', 'MALL_EXPBONUS', 'MALL_ITEMBONUS', 'MALL_GOLDBONUS', 'MAX_HP_PCT', 'MAX_SP_PCT', 'SKILL_DAMAGE_BONUS', 'NORMAL_HIT_DAMAGE_BONUS', 'SKILL_DEFEND_BONUS', 'NORMAL_HIT_DEFEND_BONUS', 'PC_BANG_EXP_BONUS', 'PC_BANG_DROP_BONUS', 'EXTRACT_HP_PCT', 'RESIST_WARRIOR', 'RESIST_ASSASSIN', 'RESIST_SURA', 'RESIST_SHAMAN', 'ENERGY', 'DEF_GRADE', 'COSTUME_ATTR_BONUS', 'MAGIC_ATTBONUS_PER', 'MELEE_MAGIC_ATTBONUS_PER', 'RESIST_ICE', 'RESIST_EARTH', 'RESIST_DARK', 'ANTI_CRITICAL_PCT', 'ANTI_PENETRATE_PCT');--> 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
CREATE TYPE "player"."item_window" AS ENUM('INVENTORY', 'EQUIPMENT', 'SAFEBOX', 'MALL', 'DRAGON_SOUL_INVENTORY', 'BELT_INVENTORY');--> statement-breakpoint
CREATE TYPE "player"."mob_ai_flag" AS ENUM('AGGR', 'NOMOVE', 'COWARD', 'NOATTSHINSU', 'NOATTCHUNJO', 'NOATTJINNO', 'ATTMOB', 'BERSERK', 'STONESKIN', 'GODSPEED', 'DEATHBLOW', 'REVIVE');--> statement-breakpoint
CREATE TYPE "player"."mob_set_immune_flag" AS ENUM('STUN', 'SLOW', 'FALL', 'CURSE', 'POISON', 'TERROR');--> statement-breakpoint
CREATE TYPE "player"."mob_set_race_flag" AS ENUM('ANIMAL', 'UNDEAD', 'DEVIL', 'HUMAN', 'ORC', 'MILGYO', 'INSECT', 'FIRE', 'ICE', 'DESERT', 'TREE', 'ATT_ELEC', 'ATT_FIRE', 'ATT_ICE', 'ATT_WIND', 'ATT_EARTH', 'ATT_DARK');--> statement-breakpoint
CREATE TYPE "player"."mob_size" AS ENUM('SMALL', 'MEDIUM', 'BIG');--> statement-breakpoint
CREATE TYPE "player"."skill_proto_set_affect_flag" AS ENUM('YMIR', 'INVISIBILITY', 'SPAWN', 'POISON', 'SLOW', 'STUN', 'DUNGEON_READY', 'FORCE_VISIBLE', 'BUILDING_CONSTRUCTION_SMALL', 'BUILDING_CONSTRUCTION_LARGE', 'BUILDING_UPGRADE', 'MOV_SPEED_POTION', 'ATT_SPEED_POTION', 'FISH_MIDE', 'JEONGWIHON', 'GEOMGYEONG', 'CHEONGEUN', 'GYEONGGONG', 'EUNHYUNG', 'GWIGUM', 'TERROR', 'JUMAGAP', 'HOSIN', 'BOHO', 'KWAESOK', 'MANASHIELD', 'MUYEONG', 'REVIVE_INVISIBLE', 'FIRE', 'GICHEON', 'JEUNGRYEOK');--> statement-breakpoint
CREATE TYPE "player"."skill_proto_set_affect_flag_2" AS ENUM('YMIR', 'INVISIBILITY', 'SPAWN', 'POISON', 'SLOW', 'STUN', 'DUNGEON_READY', 'FORCE_VISIBLE', 'BUILDING_CONSTRUCTION_SMALL', 'BUILDING_CONSTRUCTION_LARGE', 'BUILDING_UPGRADE', 'MOV_SPEED_POTION', 'ATT_SPEED_POTION', 'FISH_MIDE', 'JEONGWIHON', 'GEOMGYEONG', 'CHEONGEUN', 'GYEONGGONG', 'EUNHYUNG', 'GWIGUM', 'TERROR', 'JUMAGAP', 'HOSIN', 'BOHO', 'KWAESOK', 'MANASHIELD');--> statement-breakpoint
CREATE TYPE "player"."skill_proto_set_flag" AS ENUM('ATTACK', 'USE_MELEE_DAMAGE', 'COMPUTE_ATTGRADE', 'SELFONLY', 'USE_MAGIC_DAMAGE', 'USE_HP_AS_COST', 'COMPUTE_MAGIC_DAMAGE', 'SPLASH', 'GIVE_PENALTY', 'USE_ARROW_DAMAGE', 'PENETRATE', 'IGNORE_TARGET_RATING', 'ATTACK_SLOW', 'ATTACK_STUN', 'HP_ABSORB', 'SP_ABSORB', 'ATTACK_FIRE_CONT', 'REMOVE_BAD_AFFECT', 'REMOVE_GOOD_AFFECT', 'CRUSH', 'ATTACK_POISON', 'TOGGLE', 'DISABLE_BY_POINT_UP', 'CRUSH_LONG');--> statement-breakpoint
CREATE TYPE "player"."skill_proto_skill_type" AS ENUM('NORMAL', 'MELEE', 'RANGE', 'MAGIC');--> statement-breakpoint
CREATE TABLE "account"."account" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "account"."account_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"login" varchar(30) NOT NULL,
"password" text NOT NULL,
"social_id" varchar(13) NOT NULL,
"email" varchar(64) NOT NULL,
"status" varchar(8) DEFAULT 'OK' NOT NULL,
"security_code" varchar(192),
"available_dt" timestamp DEFAULT now() NOT NULL,
"mileage" integer DEFAULT 0 NOT NULL,
"cash" integer DEFAULT 0 NOT NULL,
"gold_expired_at" timestamp DEFAULT now() NOT NULL,
"silver_expired_at" timestamp DEFAULT now() NOT NULL,
"safebox_expired_at" timestamp DEFAULT now() NOT NULL,
"autoloot_expired_at" timestamp DEFAULT now() NOT NULL,
"fish_mind_expired_at" timestamp DEFAULT now() NOT NULL,
"marriage_fast_expired_at" timestamp DEFAULT now() NOT NULL,
"money_drop_rate_expired_at" timestamp DEFAULT now() NOT NULL,
"ip" varchar(191),
"created_at" timestamp DEFAULT now() NOT NULL,
"last_played_at" timestamp,
CONSTRAINT "account_login" UNIQUE("login"),
CONSTRAINT "account_email" UNIQUE("email")
);
--> statement-breakpoint
CREATE TABLE "common"."gm_host" (
"ip" varchar(16) NOT NULL
);
--> statement-breakpoint
CREATE TABLE "common"."gm_list" (
"player_id" integer NOT NULL,
"contact_ip" varchar(16) NOT NULL,
"server_ip" varchar(16) DEFAULT 'ALL' NOT NULL,
"authority" "common"."gm_authority" DEFAULT 'PLAYER'
);
--> statement-breakpoint
CREATE TABLE "common"."locale" (
"key" varchar(191) NOT NULL,
"value" varchar(191) NOT NULL
);
--> statement-breakpoint
CREATE TABLE "common"."spam_db" (
"type" "common"."spam_type" DEFAULT 'SPAM' NOT NULL,
"word" varchar(256) NOT NULL,
"score" integer DEFAULT 10 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "log"."boot_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."boot_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"hostname" char(128) DEFAULT 'UNKNOWN' NOT NULL,
"channel" integer DEFAULT 0 NOT NULL,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."change_name" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."change_name_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"player_id" integer NOT NULL,
"old_name" varchar(191),
"new_name" varchar(191),
"ip" varchar(20),
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."command_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."command_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"player_id" integer NOT NULL,
"server" integer NOT NULL,
"ip" varchar(15) NOT NULL,
"port" integer NOT NULL,
"username" varchar(50) NOT NULL,
"command" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "log"."cube_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."cube_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"player_id" integer NOT NULL,
"x" integer DEFAULT 0 NOT NULL,
"y" integer DEFAULT 0 NOT NULL,
"item_vnum" integer DEFAULT 0 NOT NULL,
"item_uid" integer DEFAULT 0 NOT NULL,
"item_count" integer DEFAULT 0 NOT NULL,
"success" boolean NOT NULL,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."dragon_slay_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."dragon_slay_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"guild_id" integer NOT NULL,
"vnum" integer NOT NULL,
"start_time" timestamp DEFAULT now() NOT NULL,
"end_time" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "log"."fish_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."fish_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"player_id" integer NOT NULL,
"map_index" integer DEFAULT 0 NOT NULL,
"fish_id" integer DEFAULT 0 NOT NULL,
"fishing_level" integer DEFAULT 0 NOT NULL,
"waiting_time" integer DEFAULT 0 NOT NULL,
"success" boolean NOT NULL,
"size" integer NOT NULL,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."gold_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."gold_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"player_id" integer NOT NULL,
"what" integer DEFAULT 0 NOT NULL,
"how" "log"."gold_log_how" NOT NULL,
"hint" varchar(50),
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."hack_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."hack_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"login" char(16) NOT NULL,
"name" char(24) NOT NULL,
"ip" char(15) NOT NULL,
"server" char(100) NOT NULL,
"why" char(191) NOT NULL,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."level_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."level_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"name" char(24) NOT NULL,
"level" integer DEFAULT 0 NOT NULL,
"playtime" integer DEFAULT 0 NOT NULL,
"player_id" integer NOT NULL,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"type" "log"."log_type" DEFAULT 'ITEM' NOT NULL,
"who" integer DEFAULT 0 NOT NULL,
"x" integer DEFAULT 0 NOT NULL,
"y" integer DEFAULT 0 NOT NULL,
"what" integer DEFAULT 0 NOT NULL,
"how" varchar(50) NOT NULL,
"hint" varchar(70),
"ip" varchar(20),
"vnum" integer,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."login_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."login_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"type" "log"."login_log_type",
"channel" integer,
"account_id" integer NOT NULL,
"player_id" integer NOT NULL,
"level" integer,
"job" integer,
"playtime" integer,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."login_log_2" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."login_log_2_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"type" text,
"is_gm" boolean,
"channel" integer,
"account_id" integer NOT NULL,
"player_id" integer NOT NULL,
"ip" text,
"client_version" text,
"playtime" integer DEFAULT 0 NOT NULL,
"login_at" timestamp,
"logout_at" timestamp
);
--> statement-breakpoint
CREATE TABLE "log"."money_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."money_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"type" "log"."money_log_type",
"vnum" integer DEFAULT 0 NOT NULL,
"gold" integer DEFAULT 0 NOT NULL,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."player_count" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."player_count_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"count_red" integer,
"count_yellow" integer,
"count_blue" integer,
"count_total" integer,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."quest_reward_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."quest_reward_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"quest_name" varchar(32),
"player_id" integer NOT NULL,
"player_level" integer,
"reward_type" "log"."reward_type",
"reward_value1" integer,
"reward_value2" integer,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."refine_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."refine_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"player_id" integer NOT NULL,
"item_name" varchar(24) NOT NULL,
"item_id" integer DEFAULT 0 NOT NULL,
"step" varchar(50) NOT NULL,
"is_success" boolean NOT NULL,
"set_type" "log"."refine_log_set_type" NOT NULL,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."shout_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."shout_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"channel" integer,
"empire" integer,
"shout" varchar(350),
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "log"."speed_hack_log" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "log"."speed_hack_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"player_id" integer NOT NULL,
"x" integer,
"y" integer,
"hack_count" integer,
"created_at" timestamp
);
--> statement-breakpoint
CREATE TABLE "player"."affect" (
"player_id" integer NOT NULL,
"type" integer NOT NULL,
"apply_on" integer DEFAULT 0 NOT NULL,
"apply_value" integer DEFAULT 0 NOT NULL,
"flag" integer DEFAULT 0 NOT NULL,
"duration" integer DEFAULT 0 NOT NULL,
"sp_cost" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."banword" (
"word" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."change_empire" (
"account_id" integer NOT NULL,
"change_count" integer,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."guild" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."guild_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"name" varchar(12) NOT NULL,
"sp" integer DEFAULT 1000 NOT NULL,
"master" integer DEFAULT 0 NOT NULL,
"level" integer,
"exp" integer,
"skill_point" integer DEFAULT 0 NOT NULL,
"skill" "bytea",
"win" integer DEFAULT 0 NOT NULL,
"draw" integer DEFAULT 0 NOT NULL,
"loss" integer DEFAULT 0 NOT NULL,
"ladder_point" integer DEFAULT 0 NOT NULL,
"gold" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."guild_comment" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."guild_comment_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"guild_id" integer NOT NULL,
"name" varchar(8),
"notice" integer,
"content" varchar(50),
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."guild_grade" (
"guild_id" integer NOT NULL,
"grade" integer DEFAULT 0 NOT NULL,
"name" varchar(8) NOT NULL,
"auth" "guild_grade_auth"[] DEFAULT '{}' NOT NULL,
"auth_bits" bigint GENERATED ALWAYS AS (enum_array_to_bitmask("player"."guild_grade"."auth")) STORED
);
--> statement-breakpoint
CREATE TABLE "player"."guild_member" (
"player_id" integer NOT NULL,
"guild_id" integer NOT NULL,
"grade" integer,
"is_general" boolean DEFAULT false NOT NULL,
"offer" integer,
CONSTRAINT "guild_member_player_id_guild_id_pk" PRIMARY KEY("player_id","guild_id"),
CONSTRAINT "player_id" UNIQUE("player_id")
);
--> statement-breakpoint
CREATE TABLE "player"."guild_war_bet" (
"login" varchar(24) NOT NULL,
"gold" integer DEFAULT 0 NOT NULL,
"guild_id" integer NOT NULL,
"war_id" integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."guild_war_reservation" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."guild_war_reservation_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"guild1" integer NOT NULL,
"guild2" integer NOT NULL,
"type" integer DEFAULT 0 NOT NULL,
"warprice" integer DEFAULT 0 NOT NULL,
"initial_score" integer DEFAULT 0 NOT NULL,
"started" integer DEFAULT 0 NOT NULL,
"bet_from" integer DEFAULT 0 NOT NULL,
"bet_to" integer DEFAULT 0 NOT NULL,
"winner" integer DEFAULT -1 NOT NULL,
"power_from" integer DEFAULT 0 NOT NULL,
"power_to" integer DEFAULT 0 NOT NULL,
"handicap" integer DEFAULT 0 NOT NULL,
"result_1" integer DEFAULT 0 NOT NULL,
"result_2" integer DEFAULT 0 NOT NULL,
"started_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."horse_name" (
"player_id" integer NOT NULL,
"name" varchar(24) DEFAULT 'NONAME' NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."item" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."item_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"owner_id" integer NOT NULL,
"window" "player"."item_window" DEFAULT 'INVENTORY' NOT NULL,
"position" integer NOT NULL,
"count" integer DEFAULT 0 NOT NULL,
"vnum" integer DEFAULT 0 NOT NULL,
"socket_0" integer DEFAULT 0 NOT NULL,
"socket_1" integer DEFAULT 0 NOT NULL,
"socket_2" integer DEFAULT 0 NOT NULL,
"socket_3" integer DEFAULT 0 NOT NULL,
"socket_4" integer DEFAULT 0 NOT NULL,
"socket_5" integer DEFAULT 0 NOT NULL,
"attr_type_0" integer DEFAULT 0 NOT NULL,
"attr_value_0" integer DEFAULT 0 NOT NULL,
"attr_type_1" integer DEFAULT 0 NOT NULL,
"attr_value_1" integer DEFAULT 0 NOT NULL,
"attr_type_2" integer DEFAULT 0 NOT NULL,
"attr_value_2" integer DEFAULT 0 NOT NULL,
"attr_type_3" integer DEFAULT 0 NOT NULL,
"attr_value_3" integer DEFAULT 0 NOT NULL,
"attr_type_4" integer DEFAULT 0 NOT NULL,
"attr_value_4" integer DEFAULT 0 NOT NULL,
"attr_type_5" integer DEFAULT 0 NOT NULL,
"attr_value_5" integer DEFAULT 0 NOT NULL,
"attr_type_6" integer DEFAULT 0 NOT NULL,
"attr_value_6" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."item_attr" (
"apply" "player"."item_attr_apply" DEFAULT 'MAX_HP' NOT NULL,
"probability" integer NOT NULL,
"lvl_1" integer NOT NULL,
"lvl_2" integer NOT NULL,
"lvl_3" integer NOT NULL,
"lvl_4" integer NOT NULL,
"lvl_5" integer NOT NULL,
"weapon" integer NOT NULL,
"body" integer NOT NULL,
"wrist" integer NOT NULL,
"foots" integer NOT NULL,
"neck" integer NOT NULL,
"head" integer NOT NULL,
"shield" integer NOT NULL,
"ear" integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."item_attr_rare" (
"apply" "player"."item_attr_rare_apply" DEFAULT 'MAX_HP' NOT NULL,
"probability" integer NOT NULL,
"lvl_1" integer NOT NULL,
"lvl_2" integer NOT NULL,
"lvl_3" integer NOT NULL,
"lvl_4" integer NOT NULL,
"lvl_5" integer NOT NULL,
"weapon" integer NOT NULL,
"body" integer NOT NULL,
"wrist" integer NOT NULL,
"foots" integer NOT NULL,
"neck" integer NOT NULL,
"head" integer NOT NULL,
"shield" integer NOT NULL,
"ear" integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."item_award" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."item_award_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"player_id" integer NOT NULL,
"login" varchar(30) NOT NULL,
"vnum" integer DEFAULT 0 NOT NULL,
"count" integer DEFAULT 0 NOT NULL,
"give_at" timestamp DEFAULT now() NOT NULL,
"taken_at" timestamp,
"item_id" integer,
"why" varchar(128),
"socket_0" integer DEFAULT 0 NOT NULL,
"socket_1" integer DEFAULT 0 NOT NULL,
"socket_2" integer DEFAULT 0 NOT NULL,
"mall" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."item_proto" (
"vnum" integer DEFAULT 0 NOT NULL,
"name" text NOT NULL,
"locale_name" text NOT NULL,
"type" integer DEFAULT 0 NOT NULL,
"sub_type" integer DEFAULT 0 NOT NULL,
"weight" integer DEFAULT 0,
"size" integer DEFAULT 0,
"anti_flag" integer DEFAULT 0,
"flag" integer DEFAULT 0,
"wear_flag" integer DEFAULT 0,
"immune_flag" "item_proto_immune_flag"[] DEFAULT '{}' NOT NULL,
"gold" integer DEFAULT 0,
"shop_buy_price" integer DEFAULT 0 NOT NULL,
"refined_vnum" integer DEFAULT 0 NOT NULL,
"refine_set" integer NOT NULL,
"refine_set2" integer NOT NULL,
"magic_percentage" integer DEFAULT 0 NOT NULL,
"limit_type_0" integer DEFAULT 0,
"limit_value_0" integer DEFAULT 0,
"limit_type_1" integer DEFAULT 0,
"limit_value_1" integer DEFAULT 0,
"apply_type_0" integer DEFAULT 0,
"apply_value_0" integer DEFAULT 0,
"apply_type_1" integer DEFAULT 0,
"apply_value_1" integer DEFAULT 0,
"apply_type_2" integer DEFAULT 0,
"apply_value_2" integer DEFAULT 0,
"value_0" integer DEFAULT 0,
"value_1" integer DEFAULT 0,
"value_2" integer DEFAULT 0,
"value_3" integer DEFAULT 0,
"value_4" integer DEFAULT 0,
"value_5" integer DEFAULT 0,
"socket_0" integer DEFAULT -1,
"socket_1" integer DEFAULT -1,
"socket_2" integer DEFAULT -1,
"socket_3" integer DEFAULT -1,
"socket_4" integer DEFAULT -1,
"socket_5" integer DEFAULT -1,
"specular" integer DEFAULT 0 NOT NULL,
"socket_percentage" integer DEFAULT 0 NOT NULL,
"addon_type" integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."land" (
"id" integer PRIMARY KEY NOT NULL,
"map_index" integer DEFAULT 0 NOT NULL,
"x" integer DEFAULT 0 NOT NULL,
"y" integer DEFAULT 0 NOT NULL,
"width" integer DEFAULT 0 NOT NULL,
"height" integer DEFAULT 0 NOT NULL,
"guild_id" integer DEFAULT 0 NOT NULL,
"guild_level_limit" integer DEFAULT 0 NOT NULL,
"price" integer DEFAULT 0 NOT NULL,
"enabled" boolean DEFAULT false NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."lotto_list" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."lotto_list_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"server" varchar(20),
"playerId" integer NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."marriage" (
"is_married" boolean DEFAULT false NOT NULL,
"player_id_1" integer NOT NULL,
"player_id_2" integer NOT NULL,
"love_points" integer,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."messenger_list" (
"account" varchar(16) NOT NULL,
"companion" varchar(16) NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."mob_proto" (
"vnum" integer DEFAULT 0 NOT NULL,
"name" text NOT NULL,
"locale_name" text NOT NULL,
"rank" integer DEFAULT 0 NOT NULL,
"type" integer DEFAULT 0 NOT NULL,
"battle_type" integer DEFAULT 0 NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
"size" "player"."mob_size" DEFAULT 'SMALL',
"ai_flag" "mob_ai_flag"[] DEFAULT '{}' NOT NULL,
"mount_capacity" integer DEFAULT 0 NOT NULL,
"set_race_flag" "player"."mob_set_race_flag" NOT NULL,
"set_immune_flag" "player"."mob_set_immune_flag",
"empire" integer DEFAULT 0 NOT NULL,
"folder" varchar(100) NOT NULL,
"on_click" integer DEFAULT 0 NOT NULL,
"st" integer NOT NULL,
"dx" integer NOT NULL,
"ht" integer NOT NULL,
"iq" integer NOT NULL,
"damage_min" integer NOT NULL,
"damage_max" integer NOT NULL,
"max_hp" integer DEFAULT 0 NOT NULL,
"regen_cycle" integer DEFAULT 0 NOT NULL,
"regen_percent" integer DEFAULT 0 NOT NULL,
"gold_min" integer DEFAULT 0 NOT NULL,
"gold_max" integer DEFAULT 0 NOT NULL,
"exp" integer DEFAULT 0 NOT NULL,
"def" integer NOT NULL,
"attack_speed" integer DEFAULT 100 NOT NULL,
"move_speed" integer DEFAULT 100 NOT NULL,
"aggressive_hp_percentage" integer DEFAULT 0 NOT NULL,
"aggressive_sight" integer NOT NULL,
"attack_range" integer NOT NULL,
"drop_item" integer DEFAULT 0 NOT NULL,
"resurrection_vnum" integer DEFAULT 0 NOT NULL,
"enchant_curse" integer DEFAULT 0 NOT NULL,
"enchant_slow" integer DEFAULT 0 NOT NULL,
"enchant_poison" integer DEFAULT 0 NOT NULL,
"enchant_stun" integer DEFAULT 0 NOT NULL,
"enchant_critical" integer DEFAULT 0 NOT NULL,
"enchant_penetrate" integer DEFAULT 0 NOT NULL,
"resist_sword" integer DEFAULT 0 NOT NULL,
"resist_twohand" integer DEFAULT 0 NOT NULL,
"resist_dagger" integer DEFAULT 0 NOT NULL,
"resist_bell" integer DEFAULT 0 NOT NULL,
"resist_fan" integer DEFAULT 0 NOT NULL,
"resist_bow" integer DEFAULT 0 NOT NULL,
"resist_fire" integer DEFAULT 0 NOT NULL,
"resist_elect" integer DEFAULT 0 NOT NULL,
"resist_magic" integer DEFAULT 0 NOT NULL,
"resist_wind" integer DEFAULT 0 NOT NULL,
"resist_poison" integer DEFAULT 0 NOT NULL,
"dam_multiply" double precision,
"summon" integer,
"drain_sp" integer,
"mob_color" integer,
"polymorph_item" integer DEFAULT 0 NOT NULL,
"skill_level0" integer,
"skill_vnum0" integer,
"skill_level1" integer,
"skill_vnum1" integer,
"skill_level2" integer,
"skill_vnum2" integer,
"skill_level3" integer,
"skill_vnum3" integer,
"skill_level4" integer,
"skill_vnum4" integer,
"sp_berserk" integer DEFAULT 0 NOT NULL,
"sp_stoneskin" integer DEFAULT 0 NOT NULL,
"sp_godspeed" integer DEFAULT 0 NOT NULL,
"sp_deathblow" integer DEFAULT 0 NOT NULL,
"sp_revive" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."monarch" (
"empire" integer DEFAULT 0 NOT NULL,
"player_id" integer NOT NULL,
"win_at" timestamp,
"money" integer
);
--> statement-breakpoint
CREATE TABLE "player"."monarch_candidacy" (
"player_id" integer NOT NULL,
"date" timestamp DEFAULT now(),
"name" varchar(16),
"win_at" timestamp
);
--> statement-breakpoint
CREATE TABLE "player"."monarch_election" (
"player_id" integer NOT NULL,
"selected_player_id" integer NOT NULL,
"election_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "player"."myshop_pricelist" (
"owner_id" integer NOT NULL,
"item_vnum" integer DEFAULT 0 NOT NULL,
"price" integer DEFAULT 0 NOT NULL,
CONSTRAINT "list_id" UNIQUE("owner_id","item_vnum")
);
--> statement-breakpoint
CREATE TABLE "player"."object" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."object_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"land_id" integer DEFAULT 0 NOT NULL,
"vnum" integer DEFAULT 0 NOT NULL,
"map_index" integer DEFAULT 0 NOT NULL,
"x" integer DEFAULT 0 NOT NULL,
"y" integer DEFAULT 0 NOT NULL,
"x_rot" double precision NOT NULL,
"y_rot" double precision NOT NULL,
"z_rot" double precision NOT NULL,
"life" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."object_proto" (
"vnum" integer DEFAULT 0 NOT NULL,
"name" varchar(32) NOT NULL,
"price" integer DEFAULT 0 NOT NULL,
"materials" varchar(64) NOT NULL,
"upgrade_vnum" integer DEFAULT 0 NOT NULL,
"upgrade_limit_time" integer DEFAULT 0 NOT NULL,
"life" integer DEFAULT 0 NOT NULL,
"reg_1" integer DEFAULT 0 NOT NULL,
"reg_2" integer DEFAULT 0 NOT NULL,
"reg_3" integer DEFAULT 0 NOT NULL,
"reg_4" integer DEFAULT 0 NOT NULL,
"npc" integer DEFAULT 0 NOT NULL,
"group_vnum" integer DEFAULT 0 NOT NULL,
"dependent_group" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."player" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."player_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"account_id" integer NOT NULL,
"name" varchar(24) DEFAULT 'NONAME' NOT NULL,
"job" integer DEFAULT 0 NOT NULL,
"voice" integer DEFAULT 0 NOT NULL,
"dir" integer DEFAULT 0 NOT NULL,
"x" integer DEFAULT 0 NOT NULL,
"y" integer DEFAULT 0 NOT NULL,
"z" integer DEFAULT 0 NOT NULL,
"map_index" integer DEFAULT 0 NOT NULL,
"exit_x" integer DEFAULT 0 NOT NULL,
"exit_y" integer DEFAULT 0 NOT NULL,
"exit_map_index" integer DEFAULT 0 NOT NULL,
"hp" integer NOT NULL,
"mp" integer NOT NULL,
"stamina" integer NOT NULL,
"random_hp" integer NOT NULL,
"random_sp" integer NOT NULL,
"playtime" integer DEFAULT 0 NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
"level_step" integer DEFAULT 0 NOT NULL,
"st" integer NOT NULL,
"ht" integer NOT NULL,
"dx" integer NOT NULL,
"iq" integer NOT NULL,
"exp" integer DEFAULT 0 NOT NULL,
"gold" integer DEFAULT 0 NOT NULL,
"stat_point" integer NOT NULL,
"skill_point" integer NOT NULL,
"quick_slot" "bytea",
"ip" varchar(15) DEFAULT '0.0.0.0',
"part_main" integer DEFAULT 0 NOT NULL,
"part_base" integer DEFAULT 0 NOT NULL,
"part_hair" integer DEFAULT 0 NOT NULL,
"skill_group" integer DEFAULT 0 NOT NULL,
"skill_level" integer,
"alignment" integer DEFAULT 0 NOT NULL,
"last_played_at" timestamp DEFAULT now() NOT NULL,
"change_name" integer DEFAULT 0 NOT NULL,
"sub_skill_point" integer NOT NULL,
"stat_reset_count" integer DEFAULT 0 NOT NULL,
"horse_hp" integer NOT NULL,
"horse_stamina" integer NOT NULL,
"horse_level" integer DEFAULT 0 NOT NULL,
"horse_hp_droptime" integer DEFAULT 0 NOT NULL,
"horse_riding" integer DEFAULT 0 NOT NULL,
"horse_skill_point" integer NOT NULL,
"bank_value" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."player_deleted" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "player"."player_deleted_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"account_id" integer NOT NULL,
"name" varchar(24) DEFAULT 'NONAME' NOT NULL,
"job" integer DEFAULT 0 NOT NULL,
"voice" integer DEFAULT 0 NOT NULL,
"dir" integer DEFAULT 0 NOT NULL,
"x" integer DEFAULT 0 NOT NULL,
"y" integer DEFAULT 0 NOT NULL,
"z" integer DEFAULT 0 NOT NULL,
"map_index" integer DEFAULT 0 NOT NULL,
"exit_x" integer DEFAULT 0 NOT NULL,
"exit_y" integer DEFAULT 0 NOT NULL,
"exit_map_index" integer DEFAULT 0 NOT NULL,
"hp" integer NOT NULL,
"mp" integer NOT NULL,
"stamina" integer NOT NULL,
"random_hp" integer NOT NULL,
"random_sp" integer NOT NULL,
"playtime" integer DEFAULT 0 NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
"level_step" integer DEFAULT 0 NOT NULL,
"st" integer NOT NULL,
"ht" integer NOT NULL,
"dx" integer NOT NULL,
"iq" integer NOT NULL,
"exp" integer DEFAULT 0 NOT NULL,
"gold" integer DEFAULT 0 NOT NULL,
"stat_point" integer NOT NULL,
"skill_point" integer NOT NULL,
"quick_slot" integer,
"ip" varchar(15) DEFAULT '0.0.0.0',
"part_main" integer NOT NULL,
"part_base" integer DEFAULT 0 NOT NULL,
"part_hair" integer NOT NULL,
"skill_group" integer DEFAULT 0 NOT NULL,
"skill_level" integer,
"alignment" integer DEFAULT 0 NOT NULL,
"last_played_at" timestamp DEFAULT now() NOT NULL,
"change_name" integer DEFAULT 0 NOT NULL,
"sub_skill_point" integer NOT NULL,
"stat_reset_count" integer DEFAULT 0 NOT NULL,
"horse_hp" integer NOT NULL,
"horse_stamina" integer NOT NULL,
"horse_level" integer DEFAULT 0 NOT NULL,
"horse_hp_droptime" integer DEFAULT 0 NOT NULL,
"horse_riding" integer DEFAULT 0 NOT NULL,
"horse_skill_point" integer NOT NULL,
"bank_value" integer DEFAULT 0
);
--> statement-breakpoint
CREATE TABLE "player"."player_index" (
"account_id" integer NOT NULL,
"player_id" integer NOT NULL,
"empire" integer DEFAULT 0 NOT NULL,
"last_played_at" timestamp,
CONSTRAINT "player_index_account_id_player_id_pk" PRIMARY KEY("account_id","player_id")
);
--> statement-breakpoint
CREATE TABLE "player"."quest" (
"player_id" integer NOT NULL,
"name" varchar(32) NOT NULL,
"state" varchar(64) NOT NULL,
"value" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."refine_proto" (
"id" integer PRIMARY KEY NOT NULL,
"vnum_0" integer DEFAULT 0 NOT NULL,
"count_0" integer NOT NULL,
"vnum_1" integer DEFAULT 0 NOT NULL,
"count_1" integer NOT NULL,
"vnum_2" integer DEFAULT 0 NOT NULL,
"count_2" integer NOT NULL,
"vnum_3" integer DEFAULT 0 NOT NULL,
"count_3" integer NOT NULL,
"vnum_4" integer DEFAULT 0 NOT NULL,
"count_4" integer NOT NULL,
"cost" integer DEFAULT 0 NOT NULL,
"src_vnum" integer DEFAULT 0 NOT NULL,
"result_vnum" integer DEFAULT 0 NOT NULL,
"probability" integer DEFAULT 100 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."safebox" (
"account_id" integer NOT NULL,
"size" integer DEFAULT 0 NOT NULL,
"password" varchar(6) NOT NULL,
"gold" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."shop" (
"vnum" integer PRIMARY KEY NOT NULL,
"name" varchar(32) DEFAULT 'NONAME' NOT NULL,
"npc_vnum" integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player"."shop_item" (
"shop_vnum" integer NOT NULL,
"item_vnum" integer NOT NULL,
"count" integer DEFAULT 1 NOT NULL,
CONSTRAINT "shop_vnum_unique" UNIQUE("shop_vnum","item_vnum","count")
);
--> statement-breakpoint
CREATE TABLE "player"."skill_proto" (
"vnum" integer DEFAULT 0 NOT NULL,
"name" text NOT NULL,
"type" integer DEFAULT 0 NOT NULL,
"level_step" integer DEFAULT 0 NOT NULL,
"max_level" integer DEFAULT 0 NOT NULL,
"level_limit" integer DEFAULT 0 NOT NULL,
"point_on" varchar(100) DEFAULT '0' NOT NULL,
"point_poly" varchar(100) NOT NULL,
"sp_cost_poly" varchar(100) NOT NULL,
"duration_poly" varchar(100) NOT NULL,
"duration_sp_cost_poly" varchar(100) NOT NULL,
"cooldown_poly" varchar(100) NOT NULL,
"master_bonus_poly" varchar(100) NOT NULL,
"attack_grade_poly" varchar(100) NOT NULL,
"set_flag" "skill_proto_set_flag"[] DEFAULT '{}' NOT NULL,
"set_flag_bits" bigint GENERATED ALWAYS AS (enum_array_to_bitmask("player"."skill_proto"."set_flag")) STORED,
"set_affect_flag" "player"."skill_proto_set_affect_flag",
"set_affect_flag_bits" bigint GENERATED ALWAYS AS (enum_to_bitmask("player"."skill_proto"."set_affect_flag")) STORED,
"point_on_2" varchar(100) DEFAULT 'NONE' NOT NULL,
"point_poly_2" varchar(100) NOT NULL,
"duration_poly_2" varchar(100) NOT NULL,
"set_affect_flag_2" "player"."skill_proto_set_affect_flag_2",
"set_affect_flag_2_bits" bigint GENERATED ALWAYS AS (enum_to_bitmask("player"."skill_proto"."set_affect_flag_2")) STORED,
"point_on_3" varchar(100) DEFAULT 'NONE' NOT NULL,
"point_poly_3" varchar(100) NOT NULL,
"duration_poly_3" varchar(100) NOT NULL,
"grand_master_add_sp_cost_poly" varchar(100) NOT NULL,
"prerequisite_skill_vnum" integer DEFAULT 0 NOT NULL,
"prerequisite_skill_level" integer DEFAULT 0 NOT NULL,
"skill_type" "player"."skill_proto_skill_type" DEFAULT 'NORMAL' NOT NULL,
"skill_type_bits" bigint GENERATED ALWAYS AS (enum_to_bitmask("player"."skill_proto"."skill_type")) STORED,
"max_hit" integer DEFAULT 0 NOT NULL,
"splash_around_damage_adjust_poly" varchar(100) DEFAULT '1' NOT NULL,
"target_range" integer DEFAULT 1000 NOT NULL,
"splash_range" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
ALTER TABLE "common"."gm_list" ADD CONSTRAINT "gm_list_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."change_name" ADD CONSTRAINT "change_name_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."command_log" ADD CONSTRAINT "command_log_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."fish_log" ADD CONSTRAINT "fish_log_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."gold_log" ADD CONSTRAINT "gold_log_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."level_log" ADD CONSTRAINT "level_log_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."login_log" ADD CONSTRAINT "login_log_account_id_account_id_fk" FOREIGN KEY ("account_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."login_log" ADD CONSTRAINT "login_log_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."login_log_2" ADD CONSTRAINT "login_log_2_account_id_account_id_fk" FOREIGN KEY ("account_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."login_log_2" ADD CONSTRAINT "login_log_2_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."refine_log" ADD CONSTRAINT "refine_log_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "log"."speed_hack_log" ADD CONSTRAINT "speed_hack_log_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."affect" ADD CONSTRAINT "affect_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."change_empire" ADD CONSTRAINT "change_empire_account_id_account_id_fk" FOREIGN KEY ("account_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."guild_comment" ADD CONSTRAINT "guild_comment_guild_id_guild_id_fk" FOREIGN KEY ("guild_id") REFERENCES "player"."guild"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."guild_grade" ADD CONSTRAINT "guild_grade_guild_id_guild_id_fk" FOREIGN KEY ("guild_id") REFERENCES "player"."guild"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."guild_member" ADD CONSTRAINT "guild_member_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."guild_member" ADD CONSTRAINT "guild_member_guild_id_guild_id_fk" FOREIGN KEY ("guild_id") REFERENCES "player"."guild"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."guild_war_bet" ADD CONSTRAINT "guild_war_bet_guild_id_guild_id_fk" FOREIGN KEY ("guild_id") REFERENCES "player"."guild"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."guild_war_bet" ADD CONSTRAINT "guild_war_bet_war_id_guild_war_reservation_id_fk" FOREIGN KEY ("war_id") REFERENCES "player"."guild_war_reservation"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."guild_war_reservation" ADD CONSTRAINT "guild_war_reservation_guild1_guild_id_fk" FOREIGN KEY ("guild1") REFERENCES "player"."guild"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."guild_war_reservation" ADD CONSTRAINT "guild_war_reservation_guild2_guild_id_fk" FOREIGN KEY ("guild2") REFERENCES "player"."guild"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."horse_name" ADD CONSTRAINT "horse_name_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."item_award" ADD CONSTRAINT "item_award_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."lotto_list" ADD CONSTRAINT "lotto_list_playerId_player_id_fk" FOREIGN KEY ("playerId") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."marriage" ADD CONSTRAINT "marriage_player_id_1_player_id_fk" FOREIGN KEY ("player_id_1") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."marriage" ADD CONSTRAINT "marriage_player_id_2_player_id_fk" FOREIGN KEY ("player_id_2") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."monarch" ADD CONSTRAINT "monarch_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."monarch_candidacy" ADD CONSTRAINT "monarch_candidacy_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."monarch_election" ADD CONSTRAINT "monarch_election_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."monarch_election" ADD CONSTRAINT "monarch_election_selected_player_id_player_id_fk" FOREIGN KEY ("selected_player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."player" ADD CONSTRAINT "player_account_id_account_id_fk" FOREIGN KEY ("account_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."player_deleted" ADD CONSTRAINT "player_deleted_account_id_account_id_fk" FOREIGN KEY ("account_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."player_index" ADD CONSTRAINT "player_index_account_id_account_id_fk" FOREIGN KEY ("account_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."quest" ADD CONSTRAINT "quest_player_id_player_id_fk" FOREIGN KEY ("player_id") REFERENCES "player"."player"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."safebox" ADD CONSTRAINT "safebox_account_id_account_id_fk" FOREIGN KEY ("account_id") REFERENCES "account"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player"."shop_item" ADD CONSTRAINT "shop_item_shop_vnum_shop_vnum_fk" FOREIGN KEY ("shop_vnum") REFERENCES "player"."shop"("vnum") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "account_social_id" ON "account"."account" USING btree ("social_id");--> statement-breakpoint
CREATE INDEX "locale_key" ON "common"."locale" USING btree ("key");--> statement-breakpoint
CREATE INDEX "cube_log_player_id" ON "log"."cube_log" USING btree ("player_id");--> statement-breakpoint
CREATE INDEX "cube_log_item_vnum" ON "log"."cube_log" USING btree ("item_vnum");--> statement-breakpoint
CREATE INDEX "cube_log_item_uid" ON "log"."cube_log" USING btree ("item_uid");--> statement-breakpoint
CREATE INDEX "gold_log_created_at" ON "log"."gold_log" USING btree ("created_at");--> statement-breakpoint
CREATE INDEX "gold_log_player_id" ON "log"."gold_log" USING btree ("player_id");--> statement-breakpoint
CREATE INDEX "gold_log_what" ON "log"."gold_log" USING btree ("what");--> statement-breakpoint
CREATE INDEX "gold_log_how" ON "log"."gold_log" USING btree ("how");--> statement-breakpoint
CREATE INDEX "log_who" ON "log"."log" USING btree ("who");--> statement-breakpoint
CREATE INDEX "log_what" ON "log"."log" USING btree ("what");--> statement-breakpoint
CREATE INDEX "log_how" ON "log"."log" USING btree ("how");--> statement-breakpoint
CREATE INDEX "login_log_player_id" ON "log"."login_log" USING btree ("player_id","type");--> statement-breakpoint
CREATE INDEX "money_log_type" ON "log"."money_log" USING btree ("type","vnum");--> statement-breakpoint
CREATE INDEX "quest_reward_log_player_id" ON "log"."quest_reward_log" USING btree ("player_id");--> statement-breakpoint
CREATE INDEX "shout_log_created_at" ON "log"."shout_log" USING btree ("created_at");--> statement-breakpoint
CREATE INDEX "aaa" ON "player"."guild_comment" USING btree ("notice","id","guild_id");--> statement-breakpoint
CREATE INDEX "guild_comment_guild_id" ON "player"."guild_comment" USING btree ("guild_id");--> statement-breakpoint
CREATE INDEX "item_owner_id" ON "player"."item" USING btree ("owner_id");--> statement-breakpoint
CREATE INDEX "item_window" ON "player"."item" USING btree ("window");--> statement-breakpoint
CREATE INDEX "item_vnum" ON "player"."item" USING btree ("vnum");--> statement-breakpoint
CREATE INDEX "item_award_player_id" ON "player"."item_award" USING btree ("player_id");--> statement-breakpoint
CREATE INDEX "item_award_given_at" ON "player"."item_award" USING btree ("give_at");--> statement-breakpoint
CREATE INDEX "item_award_taken_at" ON "player"."item_award" USING btree ("taken_at");--> statement-breakpoint
CREATE INDEX "object_proto_vnum" ON "player"."object_proto" USING btree ("vnum");--> statement-breakpoint
CREATE INDEX "object_proto_group_vnum" ON "player"."object_proto" USING btree ("group_vnum");--> statement-breakpoint
CREATE INDEX "object_proto_upgrade_vnum" ON "player"."object_proto" USING btree ("upgrade_vnum");--> statement-breakpoint
CREATE INDEX "player_account_id" ON "player"."player" USING btree ("account_id");--> statement-breakpoint
CREATE INDEX "player_name" ON "player"."player" USING btree ("name");--> statement-breakpoint
CREATE INDEX "player_deleted_account_id" ON "player"."player_deleted" USING btree ("account_id");--> statement-breakpoint
CREATE INDEX "player_deleted_name" ON "player"."player_deleted" USING btree ("name");--> statement-breakpoint
CREATE INDEX "player_index_empire" ON "player"."player_index" USING btree ("empire");--> statement-breakpoint
CREATE INDEX "quest_player_id" ON "player"."quest" USING btree ("player_id");--> statement-breakpoint
CREATE INDEX "quest_name" ON "player"."quest" USING btree ("name");--> statement-breakpoint
CREATE INDEX "quest_state" ON "player"."quest" USING btree ("state");--> statement-breakpoint
CREATE INDEX "refine_proto_src_vnum" ON "player"."refine_proto" USING btree ("src_vnum");--> statement-breakpoint
CREATE INDEX "refine_proto_result_vnum" ON "player"."refine_proto" USING btree ("result_vnum");--> statement-breakpoint
CREATE INDEX "shop_vnum" ON "player"."shop" USING btree ("vnum");--> statement-breakpoint
CREATE INDEX "shop_item_item_vnum" ON "player"."shop_item" USING btree ("item_vnum");