ALTER TABLE `articles` CHANGE `id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
CHANGE `title` `Title` TEXT CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL ,
CHANGE `autor` `Author` TEXT CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL ,
CHANGE `category` `Category` INT( 11 ) NOT NULL DEFAULT '0',
CHANGE `text` `Content` TEXT CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL ,
CHANGE `date` `Time` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00';

RENAME TABLE `articles`  TO `Article` ;
ALTER TABLE `Article`  ENGINE = InnoDB;

ALTER TABLE `Article` ADD INDEX ( `Category` ) ;

CREATE TABLE IF NOT EXISTS `ArticleCategory` (
  `Id` int(11) NOT NULL auto_increment,
  `Name` varchar(255) NOT NULL,
  PRIMARY KEY  (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

INSERT INTO `ArticleCategory` (`Id`, `Name`) VALUES
(1, 'Server novinky'),
(2, 'GM novinky'),
(3, 'In-game novinky'),
(4, 'Články');

ALTER TABLE `Article` ADD FOREIGN KEY ( `Category` ) REFERENCES `ArticleCategory` (`Id`);
