Файл: database/migrations/v50_11_server_only_events_cave.sql
Строк: 471
-- v50.11: server-only Valley / Altars / Cave. No CREATE DATABASE /
USE.
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `undying_v511_event` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`state`
enum('waiting','running','finished') NOT NULL DEFAULT 'waiting',
`start_at` int unsigned NOT NULL,
`battle_end` int unsigned NOT NULL
DEFAULT 0,
`last_tick` int unsigned NOT NULL DEFAULT 0,
`winner` tinyint NOT NULL DEFAULT -1,
`created_at` int unsigned NOT
NULL,
`finished_at` int unsigned NOT NULL DEFAULT 0,
PRIMARY
KEY (`id`), UNIQUE KEY `uniq_start` (`start_at`), KEY `state_time`
(`state`,`start_at`,`battle_end`)
) ENGINE=InnoDB DEFAULT
CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS
`undying_v511_member` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`event_id` int unsigned NOT NULL, `user_id` int unsigned NOT NULL
DEFAULT 0,
`team` tinyint unsigned NOT NULL DEFAULT 0, `is_bot`
tinyint(1) NOT NULL DEFAULT 0,
`name` varchar(80) NOT NULL, `clan_id`
int unsigned NOT NULL DEFAULT 0, `race` tinyint unsigned NOT NULL DEFAULT
0,
`hp` bigint unsigned NOT NULL DEFAULT 1, `max_hp` bigint unsigned
NOT NULL DEFAULT 1,
`power` bigint unsigned NOT NULL DEFAULT 1,
`defense` bigint unsigned NOT NULL DEFAULT 0,
`statue_bonus` int
unsigned NOT NULL DEFAULT 0, `damage` bigint unsigned NOT NULL DEFAULT 0,
`kills` int unsigned NOT NULL DEFAULT 0, `dead` tinyint(1) NOT NULL
DEFAULT 0,
`target_id` int unsigned NOT NULL DEFAULT 0, `joined_at`
int unsigned NOT NULL,
`last_action` int unsigned NOT NULL DEFAULT 0,
`stone_cd` int unsigned NOT NULL DEFAULT 0,
`grass_cd` int unsigned
NOT NULL DEFAULT 0, `stone_until` int unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), KEY `event_user` (`event_id`,`user_id`,`is_bot`), KEY
`event_team` (`event_id`,`team`,`dead`)
) ENGINE=InnoDB DEFAULT
CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS
`undying_v511_log` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`event_id` int unsigned NOT NULL,
`created_at` int unsigned NOT NULL,
`text` varchar(255) NOT NULL,
PRIMARY KEY (`id`), KEY `event_id`
(`event_id`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS
`undying_v511_result` (
`event_id` int unsigned NOT NULL, `user_id`
int unsigned NOT NULL, `team` tinyint unsigned NOT NULL,
`won`
tinyint(1) NOT NULL DEFAULT 0, `kills` int unsigned NOT NULL DEFAULT 0,
`damage` bigint unsigned NOT NULL DEFAULT 0,
`reward_gold` int
unsigned NOT NULL DEFAULT 0, `reward_silver` int unsigned NOT NULL DEFAULT
0,
`reward_exp` bigint unsigned NOT NULL DEFAULT 0, `reward_valor`
int unsigned NOT NULL DEFAULT 0,
`finished_at` int unsigned NOT
NULL,
PRIMARY KEY (`event_id`,`user_id`), KEY `user_last`
(`user_id`,`event_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `altar_v511_event`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`state`
enum('waiting','running','finished') NOT NULL DEFAULT 'waiting',
`start_at` int unsigned NOT NULL, `battle_end` int unsigned NOT NULL
DEFAULT 0,
`last_tick` int unsigned NOT NULL DEFAULT 0, `created_at`
int unsigned NOT NULL, `finished_at` int unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), UNIQUE KEY `uniq_start` (`start_at`), KEY `state_time`
(`state`,`start_at`,`battle_end`)
) ENGINE=InnoDB DEFAULT
CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS
`altar_v511_member` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`event_id` int unsigned NOT NULL, `user_id` int unsigned NOT NULL DEFAULT
0,
`is_bot` tinyint(1) NOT NULL DEFAULT 0, `clan_id` int unsigned NOT
NULL DEFAULT 0, `name` varchar(80) NOT NULL,
`race` tinyint unsigned
NOT NULL DEFAULT 0, `hp` bigint unsigned NOT NULL DEFAULT 1, `max_hp`
bigint unsigned NOT NULL DEFAULT 1,
`power` bigint unsigned NOT NULL
DEFAULT 1, `defense` bigint unsigned NOT NULL DEFAULT 0, `statue_bonus` int
unsigned NOT NULL DEFAULT 0,
`damage` bigint unsigned NOT NULL
DEFAULT 0, `kills` int unsigned NOT NULL DEFAULT 0, `dead` tinyint(1) NOT
NULL DEFAULT 0,
`target_id` int unsigned NOT NULL DEFAULT 0,
`joined_at` int unsigned NOT NULL, `last_action` int unsigned NOT NULL
DEFAULT 0,
`stone_cd` int unsigned NOT NULL DEFAULT 0, `grass_cd` int
unsigned NOT NULL DEFAULT 0, `stone_until` int unsigned NOT NULL DEFAULT
0,
PRIMARY KEY (`id`), KEY `event_user`
(`event_id`,`user_id`,`is_bot`), KEY `event_alive` (`event_id`,`dead`), KEY
`event_clan` (`event_id`,`clan_id`)
) ENGINE=InnoDB DEFAULT
CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS
`altar_v511_log` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`event_id` int unsigned NOT NULL, `created_at` int unsigned NOT NULL,
`text` varchar(255) NOT NULL, PRIMARY KEY (`id`), KEY `event_id`
(`event_id`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS
`altar_v511_clan_progress` (
`clan_id` int unsigned NOT NULL,
`altar_level` tinyint unsigned NOT NULL DEFAULT 1,
`wins` int
unsigned NOT NULL DEFAULT 0, `losses` int unsigned NOT NULL DEFAULT 0,
`updated_at` int unsigned NOT NULL DEFAULT 0,
PRIMARY KEY
(`clan_id`), KEY `altar_rank` (`altar_level`,`wins`)
) ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT
EXISTS `altar_v511_clan_result` (
`event_id` int unsigned NOT NULL,
`clan_id` int unsigned NOT NULL, `place` smallint unsigned NOT NULL DEFAULT
0,
`damage` bigint unsigned NOT NULL DEFAULT 0, `points` tinyint
unsigned NOT NULL DEFAULT 0,
`altar_before` tinyint unsigned NOT NULL
DEFAULT 1, `altar_after` tinyint unsigned NOT NULL DEFAULT 1,
`captured` tinyint(1) NOT NULL DEFAULT 0, `reward_gold` int unsigned NOT
NULL DEFAULT 0,
`reward_silver` bigint unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`event_id`,`clan_id`), KEY `event_place`
(`event_id`,`place`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `altar_v511_result`
(
`event_id` int unsigned NOT NULL, `user_id` int unsigned NOT NULL,
`clan_id` int unsigned NOT NULL,
`place` smallint unsigned NOT NULL
DEFAULT 0, `kills` int unsigned NOT NULL DEFAULT 0, `damage` bigint
unsigned NOT NULL DEFAULT 0,
`captured` tinyint(1) NOT NULL DEFAULT
0, `altar_before` tinyint unsigned NOT NULL DEFAULT 1,
`altar_after`
tinyint unsigned NOT NULL DEFAULT 1, `reward_silver` bigint unsigned NOT
NULL DEFAULT 0,
`reward_exp` bigint unsigned NOT NULL DEFAULT 0,
`finished_at` int unsigned NOT NULL,
PRIMARY KEY
(`event_id`,`user_id`), KEY `user_last` (`user_id`,`event_id`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE
TABLE IF NOT EXISTS `cave_v511_state` (
`user_id` int unsigned NOT
NULL,
`stage` enum('idle','searching','found','gathering') NOT NULL
DEFAULT 'idle',
`ends_at` int unsigned NOT NULL DEFAULT 0,
`res1` tinyint unsigned NOT NULL DEFAULT 0, `chance1` tinyint unsigned NOT
NULL DEFAULT 0,
`res2` tinyint unsigned NOT NULL DEFAULT 0, `chance2`
tinyint unsigned NOT NULL DEFAULT 0,
`res3` tinyint unsigned NOT NULL
DEFAULT 0, `chance3` tinyint unsigned NOT NULL DEFAULT 0,
`result_json` text NULL, `updated_at` int unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`user_id`), KEY `stage_end` (`stage`,`ends_at`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;