-- Foro estilo FusionCMS: reemplaza el esquema anterior del foro por el original.
-- Las tablas antiguas (forums, forum_categories, forum_topics, forum_posts) estaban
-- vacías de contenido (0 temas, 0 posts), así que no se pierde nada.
-- Idéntico al SQL original salvo:
--   * forum_topics.created  timestamp NOT NULL DEFAULT (now())  (faltaba en el dump)
--   * nombres de clase sin el salto de línea final del dump original ('Druid\r\n' -> 'Druid')

SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS `forums`;
DROP TABLE IF EXISTS `forum_categories`;
DROP TABLE IF EXISTS `forum_forums`;
DROP TABLE IF EXISTS `forum_topics`;
DROP TABLE IF EXISTS `forum_posts`;

CREATE TABLE `forum_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order` int(11) NOT NULL DEFAULT 0,
  `name` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `forum_forums` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` int(11) NOT NULL,
  `order` int(11) NOT NULL DEFAULT 0,
  `name` varchar(45) NOT NULL,
  `description` text NOT NULL,
  `icon` varchar(45) DEFAULT NULL,
  `colortitle` varchar(45) DEFAULT NULL,
  `type` int(11) NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `forum_topics` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `forum` int(11) NOT NULL,
  `name` varchar(45) NOT NULL,
  `sticky` tinyint(4) NOT NULL DEFAULT 0,
  `locked` tinyint(4) NOT NULL DEFAULT 0,
  `deleted` tinyint(4) NOT NULL DEFAULT 0,
  `created` timestamp NOT NULL DEFAULT (now()),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `forum_posts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `topic` int(11) NOT NULL,
  `poster` int(11) NOT NULL DEFAULT 0,
  `text` text NOT NULL,
  `time` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted` tinyint(4) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `forum_categories` (`id`, `order`, `name`) VALUES
	(1, 1, 'News'),
	(2, 2, 'Reports'),
	(3, 3, 'General'),
	(4, 4, 'Community Forums'),
	(5, 5, 'Localized Forums'),
	(6, 6, 'Class Discussions');

INSERT INTO `forum_forums` (`id`, `category`, `order`, `name`, `description`, `icon`, `colortitle`, `type`) VALUES
	(1, 1, 0, 'Latest News', 'Latest news for the community.', 'forum_read', '0', 0),
	(2, 1, 0, 'Rules and Regulations', 'Laws to abide by to keep your game experience intact.', 'forum_read', '0', 0),
	(3, 2, 0, 'Appeal a Ban', 'Appeal a ban if you think you where wrongly banned.', 'forum_read', '0', 0),
	(4, 2, 0, 'Report a Player', 'Report a player/s for breaking rules in-game.', 'forum_read', '0', 0),
	(5, 2, 0, 'Report a Gm/Dev', 'Report a Gm/Dev.', 'forum_read', '0', 0),
	(6, 3, 0, 'General Discussion', 'For anything and everything this server related.', 'forum_read', '0', 0),
	(7, 3, 0, 'Suggestions', 'Give us your thoughts on anything to do with the server.', 'forum_read', '0', 0),
	(8, 3, 0, 'Guides & Tutorials', 'Create guides to help the community.', 'forum_read', '0', 0),
	(9, 3, 0, 'Support & Q/A', 'Having trouble with something or just want to help players out?', 'forum_read', '0', 0),
	(10, 3, 0, 'Addons', 'Helpful and interesting Addons.', 'forum_read', '0', 0),
	(11, 3, 0, 'Guild Recruitment', '', 'forum_read', '0', 0),
	(12, 4, 0, 'Introduce Yourself', 'New player? Tell us a bit about yourself.', 'forum_read', '0', 0),
	(13, 4, 0, 'Dungeons and Raids', 'Everything about raiding, organization and shared experience.', 'forum_read', '0', 0),
	(14, 4, 0, 'World PvP, Arenas & Battlegrounds', 'Discuss builds, city raids, arenas and battlegrounds.', 'forum_read', '0', 0),
	(15, 4, 0, 'Specific Discussions', 'Discussion about your favorite Faction, Roleplay and ...', 'forum_read', '0', 0),
	(16, 5, 0, 'English', '', '/forum/flags2/en.svg', '0', 2),
	(17, 5, 0, 'Persian', '', '/forum/flags2/ir.svg', '0', 2),
	(18, 5, 0, 'Romania', '', '/forum/flags2/ro.svg', '0', 2),
	(19, 5, 0, 'Russian', '', '/forum/flags2/ru.svg', '0', 2),
	(20, 5, 0, 'Bulgaria', '', '/forum/flags2/bg.svg', '0', 2),
	(21, 5, 0, 'Spanish', '', '/forum/flags2/es.svg', '0', 2),
	(22, 5, 0, 'French', '', '/forum/flags2/fr.svg', '0', 2),
	(23, 5, 0, 'German', '', '/forum/flags2/de.svg', '0', 2),
	(24, 5, 0, 'Italian', '', '/forum/flags2/it.svg', '0', 2),
	(25, 5, 0, 'Polish', '', '/forum/flags2/pl.svg', '0', 2),
	(26, 6, 0, 'Death Knight', '', 'deathknight', '#C41E3A', 1),
	(27, 6, 0, 'Demon Hunter', '', 'demonhunter', '#A330C9', 1),
	(28, 6, 0, 'Druid', '', 'druid', '#FF7C0A', 1),
	(29, 6, 0, 'Evoker', '', 'evoker', '#33937F', 1),
	(30, 6, 0, 'Hunter', '', 'hunter', '#AAD372', 1),
	(31, 6, 0, 'Mage', '', 'mage', '#3FC7EB', 1),
	(32, 6, 0, 'Monk', '', 'monk', '#00FF98', 1),
	(33, 6, 0, 'Paladin', '', 'paladin', '#F48CBA', 1),
	(34, 6, 0, 'Priest', '', 'priest', '#FFFFFF', 1),
	(35, 6, 0, 'Rogue', '', 'rogue', '#FFF468', 1),
	(36, 6, 0, 'Shaman', '', 'shaman', '#0070DD', 1),
	(37, 6, 0, 'Warlock', '', 'warlock', '#8788EE', 1),
	(38, 6, 0, 'Warrior', '', 'warrior', '#C69B6D', 1);

SET FOREIGN_KEY_CHECKS = 1;
