CREATE TABLE `kategoria_osoby` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nazov` varchar(45) DEFAULT NULL,
  `visibility_type` tinyint(1) DEFAULT NULL,
  `code` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `osoba_kategoria_osoby` (
  `osoba_id` int(10) unsigned NOT NULL,
  `kategoria_osoby_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`osoba_id`,`kategoria_osoby_id`),
  KEY `fk_kategoria_osoby_id_idx` (`kategoria_osoby_id`),
  KEY `fk_osoba_id_idx` (`osoba_id`),
  CONSTRAINT `kategoria_osoby_id1` FOREIGN KEY (`kategoria_osoby_id`) REFERENCES `kategoria_osoby` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `osoba_id1` FOREIGN KEY (`osoba_id`) REFERENCES `osoba` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*1*/ ALTER TABLE `osoba`
ADD COLUMN `povolene_hromadne_emaily` TINYINT(1) NULL AFTER `visibility_type`,
ADD COLUMN `povolene_sms` TINYINT(1) NULL AFTER `povolene_hromadne_emaily`;

/* 21:55:40 ldcentrum_crm */ ALTER TABLE `osoba` ADD `kid` VARCHAR(255)  NULL  DEFAULT NULL  AFTER `povolene_sms`;
/* 22:15:00 ldcentrum_crm */ ALTER TABLE `osoba` ADD `jazyk_id` INT(11)  NULL  DEFAULT NULL  AFTER `kid`;

INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`)
VALUES
  (26211, 26200, 3, 'osoba', 'povolene_hromadne_emaily', NULL, NULL, 'Povolené hromadné emaily', 120, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL),
  (26212, 26200, 3, 'osoba', 'povolene_sms', NULL, NULL, 'Povolené sms', 130, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL),
  (26213, 26200, 5, 'osoba', 'jazyk_id', 'jazyk', NULL, 'Predvolený komunikačný jazyk', 140, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
  (26214, 26200, 9, 'osoba', 'kategoria_osoby', 'kategoria_osoby', NULL, 'Kategória osoby', 150, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL);
