CREATE TABLE tbl_kritichnost(
                         krit_id int unsigned not null auto_increment primary key,
                         kritichnost varchar(255) COLLATE utf8_general_ci,
                         pic_krit tinytext,
                         position smallint(11) NOT NULL,
                         UNIQUE KEY uc_kritichnost (kritichnost(255))
                         )ENGINE=MyISAM
                         CHARACTER SET utf8;
CREATE TABLE tbl_zhurn_strukt(
                         zh_str_id int unsigned NOT NULL auto_increment primary key,
                         strukt_name varchar(255) NOT NULL COLLATE utf8_general_ci,
                         parent int,
                         position smallint NOT NULL default '0',
                         visible enum('show','hide') NOT NULL default 'show'
                         )ENGINE=MyISAM
                         CHARACTER SET utf8;
CREATE TABLE tbl_zhurnal(
                         zhurn_id int unsigned NOT NULL auto_increment primary key,
                         krit_id int,
                         zh_str_id int,
                         zh_tema varchar(255),
                         zh_soobschenie text(4000),
                         position smallint NOT NULL default '0',
                         visible enum('show','hide') NOT NULL default 'show',
                         data timestamp not null,
                         login_id int,
                         KEY krit_id_ind (krit_id),
                         KEY zh_str_id_ind (zh_str_id)
                         )ENGINE=MyISAM
                         CHARACTER SET utf8;
ALTER TABLE `tbl_otdel` ADD COLUMN `phone` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci AFTER `visible`;
INSERT INTO `tbl_kritichnost` VALUES (1,'Для информации','../photo/krit_Dlya_informatsii_20100618114949.png',1),(2,'Не критично','../photo/krit_Ne_kritichno_20100618123543.png',2),(3,'Средне','../photo/krit_Sredne_20100618124557.png',3),(4,'Критично','../photo/krit_Kritichno_20100618123452.png',4);
GRANT SELECT,INSERT,UPDATE,DELETE ON personal.tbl_zhurnal TO personal_user@'%';
GRANT SELECT,INSERT,UPDATE,DELETE ON personal.tbl_zhurnal TO personal_user@localhost;
FLUSH PRIVILEGES;
