/* 21:33:31 */ CREATE TABLE `stredisko` (   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,   `visibility_type` int(11) NOT NULL,   `nazov` varchar(50) NOT NULL,   `analyticky_ucet` varchar(50) NOT NULL,     PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* 21:34:15 */ ALTER TABLE `stredisko` MODIFY COLUMN `visibility_type` INT(11)  NOT NULL AFTER `analyticky_ucet`;

/* 21:59:30 */ ALTER TABLE `pokrytie_sluzby_zamestnancom` ADD `stredisko_id` INT  UNSIGNED  NULL  DEFAULT NULL  AFTER `zamestnanec_id`;
/* 21:59:41 */ ALTER TABLE `pokrytie_sluzby_zamestnancom` CHANGE `stredisko_id` `stredisko_id` INT(11)  UNSIGNED  NULL  DEFAULT NULL;
/* 22:00:04 */ ALTER TABLE `pokrytie_sluzby_zamestnancom` ADD CONSTRAINT `FK_pokrytie_sluzby_zamestnancom_stredisko_id` FOREIGN KEY (`stredisko_id`) REFERENCES `stredisko` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
/* 06:14:38 */ ALTER TABLE `pokrytie_sluzby_zamestnancom` ADD `id` INT(11)  NULL  DEFAULT NULL  AFTER `hodnota`;
/* 06:14:42 */ ALTER TABLE `pokrytie_sluzby_zamestnancom` MODIFY COLUMN `id` INT(11)  NULL  DEFAULT NULL FIRST;

/*4*/ ALTER TABLE `pokrytie_sluzby_pobockou`
    ADD COLUMN `polozka_zmluvy_id` INT(11) UNSIGNED NOT NULL AFTER `zmluva_id`;
/*5*/ ALTER TABLE `pokrytie_sluzby_zamestnancom`
    ADD COLUMN `polozka_zmluvy_id` INT(11) UNSIGNED NOT NULL AFTER `zmluva_id`;

/* 23:49:57 */ ALTER TABLE `zmluva_zamestnanec` ADD `polozka_zmluvy_id` INT(11)  UNSIGNED  NULL  DEFAULT NULL  AFTER `zmluva_id`;
/* 23:50:35 */ ALTER TABLE `zmluva_zamestnanec` ADD CONSTRAINT `FK_zmluva_zamestnanec_polozka_zmluvy_id` FOREIGN KEY (`polozka_zmluvy_id`) REFERENCES `polozka_zmluvy` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;

/* 08:10:43 */ ALTER TABLE `sluzba` ADD `analyticky_ucet` VARCHAR(255)  NULL  DEFAULT NULL  AFTER `visibility_type`;
/* 08:10:54 */ ALTER TABLE `pobocka` ADD `analyticky_ucet` VARCHAR(255)  NULL  DEFAULT NULL  AFTER `nazov`;

CREATE TABLE `pokrytie_sluzby_pobockou2` (
                                             `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
                                             `polozka_zmluvy_id` int(11) unsigned NOT NULL,
                                             `sluzba_id` int(11) unsigned NOT NULL,
                                             `pobocka_id` int(11) unsigned NOT NULL,
                                             `hodnota` int(11) NOT NULL DEFAULT '0',
                                             PRIMARY KEY (`id`),
                                             KEY `FK_pokrytie_sluzby_pobockou2_pobocka_id` (`pobocka_id`),
                                             KEY `FK_pokrytie_sluzby_pobockou2_sluzba_id` (`sluzba_id`),
                                             KEY `FK_pokrytie_sluzby_pobockou2_polozka_zmluvy_id` (`polozka_zmluvy_id`),
                                             CONSTRAINT `FK_pokrytie_sluzby_pobockou2_pobocka_id` FOREIGN KEY (`pobocka_id`) REFERENCES `pobocka` (`id`),
                                             CONSTRAINT `FK_pokrytie_sluzby_pobockou2_polozka_zmluvy_id` FOREIGN KEY (`polozka_zmluvy_id`) REFERENCES `polozka_zmluvy` (`id`),
                                             CONSTRAINT `FK_pokrytie_sluzby_pobockou2_sluzba_id` FOREIGN KEY (`sluzba_id`) REFERENCES `sluzba` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `pokrytie_sluzby_zamestnancom2` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `polozka_zmluvy_id` int(11) unsigned NOT NULL,
  `sluzba_id` int(11) unsigned NOT NULL,
  `pobocka_id` int(11) unsigned NOT NULL,
  `zamestnanec_id` int(11) unsigned NOT NULL,
  `stredisko_id` int(11) unsigned DEFAULT NULL,
  `hodnota` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `FK_pokrytie_sluzby_zamestnancom2_pobocka_id` (`pobocka_id`),
  KEY `FK_pokrytie_sluzby_zamestnancom2_sluzba_id` (`sluzba_id`),
  KEY `FK_pokrytie_sluzby_zamestnancom2_zamestnanec_id` (`zamestnanec_id`),
  KEY `FK_pokrytie_sluzby_zamestnancom2_stredisko_id` (`stredisko_id`),
  CONSTRAINT `FK_pokrytie_sluzby_zamestnancom2_pobocka_id` FOREIGN KEY (`pobocka_id`) REFERENCES `pobocka` (`id`),
  CONSTRAINT `FK_pokrytie_sluzby_zamestnancom2_sluzba_id` FOREIGN KEY (`sluzba_id`) REFERENCES `sluzba` (`id`),
  CONSTRAINT `FK_pokrytie_sluzby_zamestnancom2_stredisko_id` FOREIGN KEY (`stredisko_id`) REFERENCES `stredisko` (`id`),
  CONSTRAINT `FK_pokrytie_sluzby_zamestnancom2_zamestnanec_id` FOREIGN KEY (`zamestnanec_id`) REFERENCES `zamestnanec` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;