CREATE TABLE IF NOT EXISTS `fm_admin` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `info` varchar(255) NOT NULL,
  `club` int(11) NOT NULL DEFAULT '0',
  `coach` int(11) NOT NULL DEFAULT '0',
  `gamer` int(11) NOT NULL DEFAULT '0',
  `min` int(11) NOT NULL,
  `max` int(11) NOT NULL,
  `auto` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `fm_admin` (`id`, `info`, `club`, `coach`, `gamer`, `min`, `max`, `auto`) VALUES
(1, 'Футбольный Менеджер', 1000, 500, 100, 10, 100000, 0);

CREATE TABLE IF NOT EXISTS `fm_chempionat` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  `clubs` int(11) NOT NULL,
  `price` int(11) NOT NULL,
  `level` int(11) NOT NULL,
  `timer` int(11) NOT NULL,
  `finish` set('0','1') NOT NULL DEFAULT '0',
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_chempionat_clubs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_chempionat` int(11) NOT NULL,
  `id_club` int(11) NOT NULL,
  `level` int(11) NOT NULL DEFAULT '0',
  `win` int(11) NOT NULL,
  `fre` int(11) NOT NULL,
  `lose` int(11) NOT NULL,
  `in` int(11) NOT NULL,
  `out` int(11) NOT NULL,
  `timer` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fm_chempionat_clubs` (`id_chempionat`,`id_club`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_chempionat_game` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_chempionat` int(11) NOT NULL DEFAULT '0',
  `id_club1` int(11) NOT NULL DEFAULT '0',
  `id_club2` int(11) NOT NULL DEFAULT '0',
  `goli1` int(11) NOT NULL DEFAULT '0',
  `goli2` int(11) NOT NULL DEFAULT '0',
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `time` (`time`),
  KEY `id_championat` (`id_chempionat`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_club` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) NOT NULL,
  `level` int(11) NOT NULL,
  `money` int(11) NOT NULL,
  `fani` int(11) NOT NULL DEFAULT '0',
  `win` int(11) NOT NULL,
  `fre` int(11) NOT NULL,
  `lose` int(11) NOT NULL,
  `out` int(11) NOT NULL,
  `in` int(11) NOT NULL,
  `var` int(11) NOT NULL,
  `name` varchar(64) NOT NULL,
  `timedar` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fm_club` (`id_user`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_coach` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_club` int(11) NOT NULL,
  `name` varchar(64) NOT NULL,
  `level` int(11) NOT NULL,
  `timedar` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fm_coach` (`id_club`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_game` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user` int(11) NOT NULL DEFAULT '0',
  `ank` int(11) NOT NULL DEFAULT '0',
  `balls` int(11) NOT NULL DEFAULT '0',
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_gamers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_club` int(11) NOT NULL,
  `name` varchar(32) NOT NULL,
  `poz` set('0','1','2','3') NOT NULL,
  `level` int(11) NOT NULL,
  `timevar` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fm_gamers` (`id_club`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_img` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_club` int(11) NOT NULL,
  `ras` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

INSERT INTO `fm_img` (`id`, `id_club`, `ras`, `size`, `name`, `type`) VALUES
(1, 1, 'png', '17242', '4_small', 'image/png'),
(2, 4, 'jpeg', '1907', 'images', 'image/jpeg');

CREATE TABLE IF NOT EXISTS `fm_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  `msg` varchar(1024) NOT NULL,
  `read` set('0','1') NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `id_user` (`id_user`),
  KEY `read` (`read`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_ist` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `club1` int(11) NOT NULL DEFAULT '0',
  `club2` int(11) NOT NULL DEFAULT '0',
  `goli1` int(11) NOT NULL DEFAULT '0',
  `goli2` int(11) NOT NULL DEFAULT '0',
  `balls` int(11) NOT NULL DEFAULT '0',
  `time` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_jurnal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  `msg` varchar(1024) NOT NULL,
  `read` set('0','1') NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `id_user` (`id_user`),
  KEY `read` (`read`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `fm_who` (
  `id_user` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  KEY `id_user` (`id_user`,`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `fm_who` (`id_user`, `time`) VALUES
(1, 1360165011);

