forked from NeoFrag/NeoFrag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDATABASE 0.1.3 to 0.1.4.sql
98 lines (98 loc) · 5.63 KB
/
DATABASE 0.1.3 to 0.1.4.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
INSERT INTO `nf_settings_addons` VALUES('addons', 'module', '1');
INSERT INTO `nf_settings_addons` VALUES('error', 'widget', '1');
ALTER TABLE `nf_settings_addons` CHANGE `enable` `is_enabled` ENUM('0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `nf_users` DROP `theme`;
ALTER TABLE `nf_settings_languages` DROP COLUMN `language_id`, DROP COLUMN `domain_extension`, DROP INDEX `code`, DROP PRIMARY KEY, ADD PRIMARY KEY (`code`);
INSERT INTO `nf_settings_addons` VALUES('search', 'widget', '1');
ALTER TABLE `nf_users_messages` DROP FOREIGN KEY `nf_users_messages_ibfk_1`;
ALTER TABLE `nf_users_messages` CHANGE `user_id` `reply_id` INT(11) UNSIGNED NOT NULL;
ALTER TABLE `nf_users_messages` ADD `last_reply_id` INT UNSIGNED DEFAULT NULL AFTER `title`, ADD INDEX (`last_reply_id`);
ALTER TABLE `nf_users_messages` ADD FOREIGN KEY (`reply_id`) REFERENCES `nf_users_messages_replies`(`reply_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `nf_users_messages` ADD FOREIGN KEY (`last_reply_id`) REFERENCES `nf_users_messages_replies`(`reply_id`) ON DELETE SET NULL ON UPDATE SET NULL;
ALTER TABLE `nf_users_messages` DROP `content`, DROP `date`;
ALTER TABLE `nf_users_messages_recipients` DROP `read`;
ALTER TABLE `nf_users_messages_recipients` ADD `date` TIMESTAMP NULL DEFAULT NULL AFTER `message_id`;
ALTER TABLE `nf_users_messages_recipients` ADD `deleted` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `date`;
ALTER TABLE `nf_users_messages_replies` CHANGE `content` `message` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `nf_users_messages_replies` DROP `read`;
DROP TABLE IF EXISTS `nf_awards`;
CREATE TABLE IF NOT EXISTS `nf_awards` (
`award_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`team_id` int(11) UNSIGNED DEFAULT NULL,
`game_id` int(11) UNSIGNED NOT NULL,
`image_id` int(11) UNSIGNED DEFAULT NULL,
`name` varchar(100) NOT NULL,
`location` varchar(100) NOT NULL,
`date` date NOT NULL,
`description` text NOT NULL,
`platform` varchar(100) NOT NULL,
`ranking` int(11) UNSIGNED NOT NULL,
`participants` int(11) UNSIGNED NOT NULL,
PRIMARY KEY (`award_id`),
KEY `image_id` (`image_id`),
KEY `game_id` (`game_id`),
KEY `team_id` (`team_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `nf_settings_addons` VALUES('awards', 'module', '1');
INSERT INTO `nf_settings_addons` VALUES('awards', 'widget', '1');
ALTER TABLE `nf_awards`
ADD CONSTRAINT `nf_awards_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `nf_teams` (`team_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `nf_awards_ibfk_2` FOREIGN KEY (`game_id`) REFERENCES `nf_games` (`game_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `nf_awards_ibfk_3` FOREIGN KEY (`image_id`) REFERENCES `nf_files` (`file_id`) ON DELETE CASCADE ON UPDATE CASCADE;
DROP TABLE IF EXISTS `nf_partners`;
CREATE TABLE IF NOT EXISTS `nf_partners` (
`partner_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`logo_light` int(11) UNSIGNED DEFAULT NULL,
`logo_dark` int(11) UNSIGNED DEFAULT NULL,
`website` varchar(100) NOT NULL,
`facebook` varchar(100) NOT NULL,
`twitter` varchar(100) NOT NULL,
`code` varchar(50) NOT NULL,
`count` int(11) UNSIGNED NOT NULL,
`order` tinyint(6) UNSIGNED NOT NULL,
PRIMARY KEY (`partner_id`),
KEY `image_id` (`logo_light`),
KEY `logo_dark` (`logo_dark`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `nf_partners_lang`;
CREATE TABLE IF NOT EXISTS `nf_partners_lang` (
`partner_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`lang` varchar(5) NOT NULL,
`title` varchar(100) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`partner_id`),
KEY `lang` (`lang`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `nf_settings_addons` VALUES('partners', 'module', '1');
INSERT INTO `nf_settings_addons` VALUES('partners', 'widget', '1');
INSERT INTO `nf_settings` VALUES('partners_logo_display', '', '', 'logo_dark', 'string');
ALTER TABLE `nf_partners`
ADD CONSTRAINT `nf_partners_ibfk_1` FOREIGN KEY (`logo_light`) REFERENCES `nf_files` (`file_id`) ON DELETE SET NULL ON UPDATE SET NULL,
ADD CONSTRAINT `nf_partners_ibfk_2` FOREIGN KEY (`logo_dark`) REFERENCES `nf_files` (`file_id`) ON DELETE SET NULL ON UPDATE SET NULL;
ALTER TABLE `nf_partners_lang`
ADD CONSTRAINT `nf_partners_lang_ibfk_1` FOREIGN KEY (`partner_id`) REFERENCES `nf_partners` (`partner_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `nf_partners_lang_ibfk_2` FOREIGN KEY (`lang`) REFERENCES `nf_settings_languages` (`code`) ON DELETE CASCADE ON UPDATE CASCADE;
DROP TABLE IF EXISTS `nf_games_maps`;
CREATE TABLE IF NOT EXISTS `nf_games_maps` (
`map_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`game_id` int(11) UNSIGNED NOT NULL,
`image_id` int(11) UNSIGNED DEFAULT NULL,
`title` varchar(100) NOT NULL,
PRIMARY KEY (`map_id`),
KEY `game_id` (`game_id`),
KEY `image_id` (`image_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `nf_games_modes`;
CREATE TABLE IF NOT EXISTS `nf_games_modes` (
`mode_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`game_id` int(11) UNSIGNED NOT NULL,
`title` varchar(100) NOT NULL,
PRIMARY KEY (`mode_id`),
KEY `game_id` (`game_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `nf_games_maps`
ADD CONSTRAINT `nf_games_maps_ibfk_1` FOREIGN KEY (`game_id`) REFERENCES `nf_games` (`game_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `nf_games_maps_ibfk_2` FOREIGN KEY (`image_id`) REFERENCES `nf_files` (`file_id`) ON DELETE SET NULL ON UPDATE SET NULL;
ALTER TABLE `nf_games_modes`
ADD CONSTRAINT `nf_games_modes_ibfk_1` FOREIGN KEY (`game_id`) REFERENCES `nf_games` (`game_id`) ON DELETE CASCADE ON UPDATE CASCADE;