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=0;

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=0;


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=0;

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=0;

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=0;

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;

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=0;


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=0;

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=0;


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=0;

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


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=0;


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=0;

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=0;



ALTER TABLE `user` ADD `fm_money` int( 11) NOT NULL  default '0';


