INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (150, 21000, 'Pobočky', 'pobocka_vypis', 30, 2, 1);
INSERT INTO `form` (`id`, `nazov`, `code`) VALUES (70, 'Pobocka', 'pobocka');

/*1*/ CREATE TABLE `pobocka` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `visibility_type` INT NOT NULL,
  `nazov` VARCHAR(50) NOT NULL,
  `poznamka` VARCHAR(255) NOT NULL,
  PRIMARY KEY (`id`)
)
  COLLATE='utf8_general_ci'
;
/*2*/ CREATE TABLE `zamestnanec_pobocka` (
  `zamestnanec_id` INT NOT NULL,
  `pobocka_id` INT NOT NULL
)
  COLLATE='utf8_general_ci'
;
/*3*/ INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`) VALUES ('10', '70', 'Základné informácie', 'pobocka_zakladne_informacie', '10');
/*4*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `column_title`, `position`, `direct_to_db`) VALUES ('49', '10', '1', 'pobocka', 'nazov', 'Názov', '10', '1');
/*5*/ ALTER TABLE `pobocka`
  ALTER `poznamka` DROP DEFAULT;
/*6*/ ALTER TABLE `pobocka`
  CHANGE COLUMN `poznamka` `analyticky_ucet` VARCHAR(255) NOT NULL AFTER `nazov`;
/*7*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `column_title`, `position`, `direct_to_db`) VALUES ('50', '10', '1', 'pobocka', 'analitycky_ucet', 'Analitický účet', '20', '1');
/*8*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `column_title`, `position`, `direct_to_db`, `css_class`, `direct_multi_label`, `direct_multi_data`) VALUES ('51', '10', '9', 'pobocka', 'zamestnanec_id', 'zamestnanec_pobocka', 'Zamestnanci', '30', '1', 'select2', '1', '1');
/*9*/ UPDATE `form_element` SET `db_multi_table`='zamestnanec' WHERE  `id`=51;
/*10*/ UPDATE `form_element` SET `db_multivalue_table`='zamestnanec_pobocka' WHERE  `id`=51;
/*11*/ UPDATE `form_element` SET `db_multivalue_table`=NULL WHERE  `id`=51;
/*12*/ ALTER TABLE `zamestnanec_pobocka`
  ALTER `pobocka_id` DROP DEFAULT;
/*13*/ ALTER TABLE `zamestnanec_pobocka`
  CHANGE COLUMN `pobocka_id` `pobocka_id` INT(11) NOT NULL FIRST,
  ADD PRIMARY KEY (`pobocka_id`, `zamestnanec_id`);
/*14*/ RENAME TABLE `zamestnanec_pobocka` TO `pobocka_zamestnanec`;
/*15*/ UPDATE `form_element` SET `db_column`='analyticky_ucet' WHERE  `id`=50;
/*16*/ INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (38, 'Pridanie pobočky', 'pobocka_pridaj', NULL);
/*17*/ INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (39, 'Editovanie pobočky', 'pobocka_edituj', NULL);
/*18*/ INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (40, 'Zmazanie pobočky', 'pobocka_zmaz', NULL);
/*19*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (153, 150, 'Detail pobočky', 'pobocka_view', 10, 3, 1);
/*20*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (154, 150, 'Editovanie pobočky', 'pobocka_edituj', 20, 3, 1);
/*21*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (155, 150, 'Zmazanie pobočky', 'pobocka_zmaz', 30, 3, 0);
/*22*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (151, 150, 'Pridanie pobočky', 'pobocka_pridaj', 20, 2, 0);
/*23*/ DELETE FROM `menu` WHERE  `id`=151;
/*24*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (152, 150, 'Výpis pobočiek', 'pobocka_vypis', 10, 2, 0);
/*25*/ UPDATE `menu` SET `menu_id`='21000' WHERE  `id`=152;
/*26*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (151, 21000, 'Pridanie pobočky', 'pobocka_pridaj', 20, 2, 0);
/*27*/ DELETE FROM `menu` WHERE  `id`=152;
/*28*/ DELETE FROM `form_element` WHERE  `id`=51;
/*29*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `column_title`, `position`, `direct_to_db`, `css_style`, `direct_multi_label`, `direct_multi_data`) VALUES ('51', '21001', '9', 'zamestnanec', 'pobocka_id', 'pobocka', 'Pobočka', '50', '1', 'select2', '1', '1');
/*30*/ ALTER TABLE `pobocka_zamestnanec`
  ALTER `zamestnanec_id` DROP DEFAULT;
/*31*/ ALTER TABLE `pobocka_zamestnanec`
  CHANGE COLUMN `zamestnanec_id` `zamestnanec_id` INT(11) NOT NULL FIRST;
/*32*/ RENAME TABLE `pobocka_zamestnanec` TO `zamestnanec_pobocka`;
/*33*/ UPDATE `form_element` SET `css_style`=NULL, `css_class`='select2' WHERE  `id`=51;

