CREATE TABLE `menu` (
  `id` int(11) unsigned NOT NULL,
  `menu_id` int(11) unsigned DEFAULT NULL,
  `nazov` varchar(50) DEFAULT NULL,
  `page` varchar(100) DEFAULT NULL,
  `poradie` int(11) DEFAULT NULL,
  `level` int(11) DEFAULT NULL,
  `visibility_type` tinyint(1) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `menu_FKIndex1` (`menu_id`),
  CONSTRAINT `fk_menu_menu` FOREIGN KEY (`menu_id`) REFERENCES `menu` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into `typ_suboru`(`id`,`nazov`,`code`) values (1,'Fotka','fotka');
insert into `typ_suboru`(`id`,`nazov`,`code`) values (2,'Súbor','subor');

CREATE TABLE IF NOT EXISTS `fakturacne_udaje` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `nazov_spolocnosti` varchar(255) DEFAULT NULL,
  `ulica` varchar(100) DEFAULT NULL,
  `psc` varchar(50) DEFAULT NULL,
  `mesto` varchar(100) DEFAULT NULL,
  `mobil` varchar(50) DEFAULT NULL,
  `ico` varchar(50) DEFAULT NULL,
  `dic` varchar(50) DEFAULT NULL,
  `icdph` varchar(50) DEFAULT NULL,
  `vlozka` varchar(50) DEFAULT NULL,
  `oddiel` varchar(50) DEFAULT NULL,
  `podpis` varchar(50) DEFAULT NULL,
  `peciatka` varchar(50) DEFAULT NULL,
  `prevadzka_nazov` varchar(255) DEFAULT NULL,
  `prevadzka_ulica` varchar(100) DEFAULT NULL,
  `dolny_text` text,
  `pobox` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE `zamestnanec_role` (
  `zamestnanec_id` int(11) unsigned NOT NULL,
  `role_id` int(11) unsigned NOT NULL,
  PRIMARY KEY (`zamestnanec_id`,`role_id`),
  KEY `role_id` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


insert into `log_type`(`nazov`,`code`,`primary_table`) values ('Správne prihlásenie','nespravny_login',null);
insert into `log_type`(`nazov`,`code`,`primary_table`) values ('Nesprávne prihlásenie','spravny_login',null);

insert into `menu`(`id`,`menu_id`,`nazov`,`page`,`poradie`,`level`,`visibility_type`) values (10,null,'Home','home',1,1,1);
insert into `menu`(`id`,`menu_id`,`nazov`,`page`,`poradie`,`level`,`visibility_type`) values (20,null,'Odhlásiť','logout',999,1,1);

insert into `role`(`id`,`nazov`) values (1,'Admin');
insert into `permission`(`id`,`nazov`) values (1,'all');
insert into `role_permission`(`role_id`,`permission_id`) values (1,1);
insert into `zamestnanec_role`(`zamestnanec_id`,`role_id`) values (1,1);

CREATE TABLE `typ_webmenu` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `nazov` varchar(255) DEFAULT NULL,
  `code` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `webmenu` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `typ_webmenu_id` int(11) unsigned NOT NULL,
  `webmenu_id` int(11) unsigned NOT NULL,
  `web_nazov` varchar(255) DEFAULT NULL,
  `nazov` varchar(255) DEFAULT NULL,
  `code` varchar(255) DEFAULT NULL,
  `seonazov` varchar(255) DEFAULT NULL,
  `poradie` int(11) unsigned DEFAULT NULL,
  `visibility_type` tinyint(1) unsigned DEFAULT NULL,
  `target` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `webmenu_id` (`webmenu_id`),
  KEY `typ_webmenu_id` (`typ_webmenu_id`),
  CONSTRAINT `webmenu_ibfk_1` FOREIGN KEY (`webmenu_id`) REFERENCES `webmenu` (`id`),
  CONSTRAINT `webmenu_ibfk_2` FOREIGN KEY (`typ_webmenu_id`) REFERENCES `typ_webmenu` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

