122 行
5.8 KiB
SQL
122 行
5.8 KiB
SQL
--
|
|
-- Tables
|
|
--
|
|
CREATE TABLE IF NOT EXISTS `users` (
|
|
`id` int(10) NOT NULL,
|
|
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
|
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
|
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
|
`remember_token` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT NULL,
|
|
`updated_at` timestamp NULL DEFAULT NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
|
|
CREATE TABLE IF NOT EXISTS `usr_details` (
|
|
`user_id` int(10) NOT NULL,
|
|
`total_posts` int(10) NOT NULL,
|
|
`total_threads` int(10) NOT NULL,
|
|
`reg_date` int(10) NOT NULL,
|
|
`last_post_date` int(10) NOT NULL,
|
|
`last_post_location` int(10) NOT NULL,
|
|
`ontime` int(10) NOT NULL,
|
|
`strikes` int(1) NOT NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
|
|
CREATE TABLE IF NOT EXISTS `usr_profile` (
|
|
`user_id` int(10) NOT NULL,
|
|
`gender` int(1) NOT NULL,
|
|
`member_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`website_address` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`website_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`location` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`birthday` int(10) NOT NULL,
|
|
`bio` text COLLATE utf8_unicode_ci NOT NULL,
|
|
`ip_address` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
|
|
`avatar` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`ostatus` int(1) NOT NULL DEFAULT 1,
|
|
`header` text COLLATE utf8_unicode_ci NOT NULL,
|
|
`footer` text COLLATE utf8_unicode_ci NOT NULL,
|
|
`post_style` text COLLATE utf8_unicode_ci NOT NULL,
|
|
`signature` text COLLATE utf8_unicode_ci NOT NULL,
|
|
`name_style` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
|
|
`display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`yt_channel` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`country` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`date_format` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
`isClock24` int(1) NOT NULL DEFAULT 1,
|
|
`isShowSeconds` int(1) NOT NULL,
|
|
`isShowTimezone` int(1) NOT NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
|
|
CREATE TABLE IF NOT EXISTS `usr_perm_id` (
|
|
`user_id` int(10) NOT NULL,
|
|
`perm_id` int(10) NOT NULL,
|
|
`usr_per_id` int(10) NOT NULL DEFAULT 4,
|
|
`blg_per_id` int(10) NOT NULL DEFAULT 4,
|
|
`for_per_id` int(10) NOT NULL DEFAULT 4,
|
|
`sbx_per_id` int(10) NOT NULL DEFAULT 4,
|
|
`str_per_id` int(10) NOT NULL DEFAULT 4
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
|
|
CREATE TABLE IF NOT EXISTS `str_category_loc` (
|
|
`id` int(10) NOT NULL,
|
|
`ref_id` int(10) NOT NULL,
|
|
`loc_id` int(10) NOT NULL,
|
|
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT COLLATE=utf8_unicode_ci;
|
|
|
|
CREATE TABLE IF NOT EXISTS `str_games` (
|
|
`id` int(10) NOT NULL,
|
|
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
|
|
CREATE TABLE IF NOT EXISTS `str_games_loc` (
|
|
`id` int(10) NOT NULL,
|
|
`ref_id` int(10) NOT NULL,
|
|
`loc_id` int(10) NOT NULL,
|
|
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8_unicode_ci;
|
|
|
|
CREATE TABLE IF NOT EXISTS `str_locale` (
|
|
`id` int(10) NOT NULL,
|
|
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8_unicode_ci;
|
|
|
|
--
|
|
-- Data
|
|
--
|
|
-- Port users, and split up in separate tables.
|
|
INSERT INTO `users` SELECT `id`, `username`, `email`, `password`, NULL, NULL, NULL FROM `for_users`;
|
|
INSERT INTO `usr_details` SELECT `id`, `total_posts`, `total_threads`, `reg_date`, `last_post_date`, `last_post_location`, `ontime`, `strikes` FROM `for_users`;
|
|
INSERT INTO `usr_profile` SELECT `id`, `gender`, `member_title`, `website_address`, `website_name`, `location`, `birthday`, `bio`, `ip_address`, `avatar`, `ostatus`, `header`, `footer`, NULL, NULL, `name_colour`, `display_name`, `yt_channel`, `country`, `curDF`, NULL, NULL, NULL FROM `for_users`;
|
|
INSERT INTO `usr_perm_id` SELECT `id`, `perm_id`, `usr_per_id`, `blg_per_id`, `for_per_id`, `sbx_per_id`, `str_per_id` FROM `for_users`;
|
|
-- Add game support.
|
|
INSERT INTO `str_games` (`id`, `name`) VALUES (NULL, 'MKDS'), (NULL, 'MK7');
|
|
-- Change parents into games, and add support for that..
|
|
ALTER TABLE `str_category` CHANGE `parent_id` `game_id` INT(10) NOT NULL;
|
|
ALTER TABLE `str_file` ADD `game_id` INT(10) NOT NULL AFTER `id`;
|
|
-- Video support.
|
|
ALTER TABLE `str_file` ADD `video` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER `version`;
|
|
-- Video, changelog, warningnote, failreason, and breakreason should be nullable.
|
|
ALTER TABLE `str_file` CHANGE `video` `video` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL, CHANGE `changelog` `changelog` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL, CHANGE `warningnote` `warningnote` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL, CHANGE `failreason` `failreason` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL, CHANGE `breakreason` `breakreason` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
|
|
|
|
INSERT INTO `str_locale` (`id`, `name`) VALUES (1, 'en'), (2, 'ja');
|
|
|
|
--
|
|
-- Indexes
|
|
--
|
|
ALTER TABLE `users`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `email` (`email`);
|
|
ALTER TABLE `usr_details`
|
|
ADD PRIMARY KEY (`user_id`);
|
|
ALTER TABLE `usr_profile`
|
|
ADD PRIMARY KEY (`user_id`);
|
|
ALTER TABLE `usr_perm_id`
|
|
ADD PRIMARY KEY (`user_id`);
|
|
ALTER TABLE `str_category_loc`
|
|
ADD PRIMARY KEY (`id`);
|
|
ALTER TABLE `str_games_loc`
|
|
ADD PRIMARY KEY (`id`);
|
|
ALTER TABLE `str_locale`
|
|
ADD PRIMARY KEY (`id`); |