ALTER TABLE `riziko`
	ADD COLUMN `vytvoril_id` INT NULL AFTER `projekt_rizika_id`,
	ADD COLUMN `datum_vytvorenia` TIMESTAMP NULL DEFAULT NOW() AFTER `vytvoril_id`,
	ADD COLUMN `schvalil_id` INT NULL AFTER `datum_vytvorenia`,
	ADD COLUMN `datum_schvalenia` TIMESTAMP NULL AFTER `schvalil_id`;

/*1*/ ALTER TABLE `riziko`
	CHANGE COLUMN `vytvoril_id` `vytvoril_id` INT(11) UNSIGNED NULL DEFAULT NULL AFTER `projekt_rizika_id`,
	CHANGE COLUMN `schvalil_id` `schvalil_id` INT(11) UNSIGNED NULL DEFAULT NULL AFTER `datum_vytvorenia`,
	ADD CONSTRAINT `FK_riziko_vytvoril` FOREIGN KEY (`vytvoril_id`) REFERENCES `zamestnanec` (`id`),
	ADD CONSTRAINT `FK_riziko_schvalil` FOREIGN KEY (`schvalil_id`) REFERENCES `zamestnanec` (`id`);

/*1*/ 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`, `read_only`) VALUES ('207', '191', '5', 'riziko', 'vytvoril', 'zamestnanec', 'Vytvoril', '80', '1', '1');
/*2*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `column_title`, `position`, `direct_to_db`, `read_only`) VALUES ('208', '191', '11', 'riziko', 'datum_vytvorenia', 'Dátum vytvorenia', '90', '1', '1');
/*3*/ 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`, `read_only`) VALUES ('209', '191', '5', 'riziko', 'schvalil', 'zamestnanec', 'Schválil', '100', '1', '1');
/*4*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `column_title`, `position`, `direct_to_db`, `read_only`) VALUES ('211', '191', '11', 'riziko', 'datum_schvalenia', 'Dátum schválenia', '110', '1', '1');
UPDATE `form_element` SET `attribute`='{"datetime_format":"d.m.Y H:i:s","step":1}' WHERE  `id`=208;
UPDATE `form_element` SET `attribute`='{"datetime_format":"d.m.Y H:i:s","step":1}' WHERE  `id`=211;

/*1*/ UPDATE `form_element` SET `direct_to_db`=NULL WHERE  `id`=209;
/*2*/ UPDATE `form_element` SET `direct_to_db`=NULL WHERE  `id`=207;
/*3*/ UPDATE `form_element` SET `direct_multi_label`='1' WHERE  `id`=209;
/*4*/ UPDATE `form_element` SET `direct_multi_label`='1' WHERE  `id`=207;
/*5*/ UPDATE `form_element` SET `css_class`='select2' WHERE  `id`=207;
/*6*/ UPDATE `form_element` SET `css_class`='select2' WHERE  `id`=209;
/*7*/ UPDATE `form_element` SET `direct_to_db`=NULL WHERE  `id`=206;

/*1*/ ALTER TABLE `stav_schvalenia`
	ADD COLUMN `code` VARCHAR(50) NULL DEFAULT NULL AFTER `nazov`;
/*2*/ UPDATE `stav_schvalenia` SET `code`='caka_na_schvalenie' WHERE  `id`=1;
/*3*/ UPDATE `stav_schvalenia` SET `code`='schvalene' WHERE  `id`=2;
/*4*/ UPDATE `stav_schvalenia` SET `code`='neschvalene' WHERE  `id`=3;

/*1*/ UPDATE `riziko` SET `stav_schvalenia_id`='1' WHERE  `id`=44;
/*2*/ UPDATE `form_element` SET `db_column`='vytvoril_id' WHERE  `id`=207;
/*3*/ UPDATE `form_element` SET `db_column`='schvalil_id' WHERE  `id`=209;
/*4*/ UPDATE `form_element` SET `direct_to_db`=NULL WHERE  `id`=211;
/*5*/ UPDATE `form_element` SET `direct_to_db`=NULL WHERE  `id`=208;

