2011-11-30 06:13:59 +01:00
|
|
|
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
|
|
|
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
|
|
|
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `group`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS `group` (
|
2012-03-04 05:59:53 +01:00
|
|
|
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
|
`name` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
PRIMARY KEY (`id`) ,
|
|
|
|
UNIQUE INDEX `name` (`name` ASC) )
|
|
|
|
ENGINE = InnoDB
|
|
|
|
AUTO_INCREMENT = 5
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `world`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS `world` (
|
2012-03-04 05:59:53 +01:00
|
|
|
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
|
`name` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
PRIMARY KEY (`id`) ,
|
|
|
|
UNIQUE INDEX `name` (`name` ASC) )
|
|
|
|
ENGINE = InnoDB
|
|
|
|
AUTO_INCREMENT = 9
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `region`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS `region` (
|
2012-03-04 05:59:53 +01:00
|
|
|
`id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`world_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`type` ENUM('cuboid','poly2d','global') CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`priority` SMALLINT(6) NOT NULL DEFAULT '0' ,
|
|
|
|
`parent` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL ,
|
2011-11-30 06:13:59 +01:00
|
|
|
PRIMARY KEY (`id`, `world_id`) ,
|
|
|
|
INDEX `fk_region_world` (`world_id` ASC) ,
|
2012-03-04 05:59:53 +01:00
|
|
|
INDEX `parent` (`parent` ASC) ,
|
|
|
|
CONSTRAINT `fk_region_world1`
|
|
|
|
FOREIGN KEY (`world_id` )
|
|
|
|
REFERENCES `world` (`id` )
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE,
|
2011-11-30 06:13:59 +01:00
|
|
|
CONSTRAINT `parent`
|
|
|
|
FOREIGN KEY (`parent` )
|
|
|
|
REFERENCES `region` (`id` )
|
|
|
|
ON DELETE SET NULL
|
2012-03-04 05:59:53 +01:00
|
|
|
ON UPDATE CASCADE)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `region_cuboid`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS `region_cuboid` (
|
|
|
|
`region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`world_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`min_x` BIGINT(20) NOT NULL ,
|
|
|
|
`min_y` BIGINT(20) NOT NULL ,
|
|
|
|
`min_z` BIGINT(20) NOT NULL ,
|
|
|
|
`max_x` BIGINT(20) NOT NULL ,
|
|
|
|
`max_y` BIGINT(20) NOT NULL ,
|
|
|
|
`max_z` BIGINT(20) NOT NULL ,
|
|
|
|
PRIMARY KEY (`region_id`, `world_id`) ,
|
|
|
|
INDEX `fk_region_cuboid_region` (`region_id` ASC) ,
|
|
|
|
CONSTRAINT `fk_region_cuboid_region`
|
|
|
|
FOREIGN KEY (`region_id` , `world_id` )
|
|
|
|
REFERENCES `region` (`id` , `world_id` )
|
2011-11-30 06:13:59 +01:00
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE)
|
2012-03-04 05:59:53 +01:00
|
|
|
ENGINE = InnoDB
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `region_flag`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS `region_flag` (
|
2012-03-04 05:59:53 +01:00
|
|
|
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
|
`region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`world_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`flag` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`value` VARCHAR(256) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
2011-11-30 06:13:59 +01:00
|
|
|
PRIMARY KEY (`id`) ,
|
2012-03-04 05:59:53 +01:00
|
|
|
INDEX `fk_flags_region` (`region_id` ASC, `world_id` ASC) ,
|
|
|
|
CONSTRAINT `fk_flags_region`
|
|
|
|
FOREIGN KEY (`region_id` , `world_id` )
|
|
|
|
REFERENCES `region` (`id` , `world_id` )
|
2011-11-30 06:13:59 +01:00
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE)
|
2012-03-04 05:59:53 +01:00
|
|
|
ENGINE = InnoDB
|
|
|
|
AUTO_INCREMENT = 3246
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
2012-03-04 05:59:53 +01:00
|
|
|
-- Table `region_groups`
|
2011-11-30 06:13:59 +01:00
|
|
|
-- -----------------------------------------------------
|
2012-03-04 05:59:53 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `region_groups` (
|
|
|
|
`region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`world_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`group_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`owner` TINYINT(1) NOT NULL ,
|
|
|
|
PRIMARY KEY (`region_id`, `world_id`, `group_id`) ,
|
|
|
|
INDEX `fk_region_groups_region` (`region_id` ASC) ,
|
|
|
|
INDEX `fk_region_groups_group` (`group_id` ASC) ,
|
|
|
|
CONSTRAINT `fk_region_groups_group`
|
|
|
|
FOREIGN KEY (`group_id` )
|
|
|
|
REFERENCES `group` (`id` )
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE,
|
|
|
|
CONSTRAINT `fk_region_groups_region`
|
|
|
|
FOREIGN KEY (`region_id` , `world_id` )
|
|
|
|
REFERENCES `region` (`id` , `world_id` )
|
2011-11-30 06:13:59 +01:00
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE)
|
2012-03-04 05:59:53 +01:00
|
|
|
ENGINE = InnoDB
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
2012-03-04 05:59:53 +01:00
|
|
|
-- Table `user`
|
2011-11-30 06:13:59 +01:00
|
|
|
-- -----------------------------------------------------
|
2012-03-04 05:59:53 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `user` (
|
|
|
|
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
|
`name` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
PRIMARY KEY (`id`) ,
|
|
|
|
UNIQUE INDEX `name` (`name` ASC) )
|
|
|
|
ENGINE = InnoDB
|
|
|
|
AUTO_INCREMENT = 82
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `region_players`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS `region_players` (
|
2012-03-04 05:59:53 +01:00
|
|
|
`region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`world_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`user_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`owner` TINYINT(1) NOT NULL ,
|
|
|
|
PRIMARY KEY (`region_id`, `world_id`, `user_id`) ,
|
2011-11-30 06:13:59 +01:00
|
|
|
INDEX `fk_region_players_region` (`region_id` ASC) ,
|
2012-03-04 05:59:53 +01:00
|
|
|
INDEX `fk_region_users_user` (`user_id` ASC) ,
|
|
|
|
CONSTRAINT `fk_region_users_region`
|
|
|
|
FOREIGN KEY (`region_id` , `world_id` )
|
|
|
|
REFERENCES `region` (`id` , `world_id` )
|
2011-11-30 06:13:59 +01:00
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE,
|
2012-03-04 05:59:53 +01:00
|
|
|
CONSTRAINT `fk_region_users_user`
|
2011-11-30 06:13:59 +01:00
|
|
|
FOREIGN KEY (`user_id` )
|
|
|
|
REFERENCES `user` (`id` )
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE)
|
2012-03-04 05:59:53 +01:00
|
|
|
ENGINE = InnoDB
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
2012-03-04 05:59:53 +01:00
|
|
|
-- Table `region_poly2d`
|
2011-11-30 06:13:59 +01:00
|
|
|
-- -----------------------------------------------------
|
2012-03-04 05:59:53 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `region_poly2d` (
|
|
|
|
`region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`world_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`min_y` INT(11) NOT NULL ,
|
|
|
|
`max_y` INT(11) NOT NULL ,
|
|
|
|
PRIMARY KEY (`region_id`, `world_id`) ,
|
|
|
|
INDEX `fk_region_poly2d_region` (`region_id` ASC) ,
|
|
|
|
CONSTRAINT `fk_region_poly2d_region`
|
|
|
|
FOREIGN KEY (`region_id` , `world_id` )
|
|
|
|
REFERENCES `region` (`id` , `world_id` )
|
2011-11-30 06:13:59 +01:00
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE)
|
2012-03-04 05:59:53 +01:00
|
|
|
ENGINE = InnoDB
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `region_poly2d_point`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS `region_poly2d_point` (
|
2012-03-04 05:59:53 +01:00
|
|
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
|
`region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
|
|
|
|
`world_id` INT(10) UNSIGNED NOT NULL ,
|
|
|
|
`x` BIGINT(20) NOT NULL ,
|
|
|
|
`z` BIGINT(20) NOT NULL ,
|
2011-11-30 06:13:59 +01:00
|
|
|
PRIMARY KEY (`id`) ,
|
2012-03-04 05:59:53 +01:00
|
|
|
INDEX `fk_region_poly2d_point_region_poly2d` (`region_id` ASC, `world_id` ASC) ,
|
2011-11-30 06:13:59 +01:00
|
|
|
CONSTRAINT `fk_region_poly2d_point_region_poly2d`
|
2012-03-04 05:59:53 +01:00
|
|
|
FOREIGN KEY (`region_id` , `world_id` )
|
|
|
|
REFERENCES `region_poly2d` (`region_id` , `world_id` )
|
2011-11-30 06:13:59 +01:00
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE)
|
2012-03-04 05:59:53 +01:00
|
|
|
ENGINE = InnoDB
|
|
|
|
AUTO_INCREMENT = 15
|
|
|
|
DEFAULT CHARACTER SET = utf8
|
|
|
|
COLLATE = utf8_bin;
|
2011-11-30 06:13:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET SQL_MODE=@OLD_SQL_MODE;
|
|
|
|
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
|
|
|
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|