CREATE TABLE `pharmalink_doktor_subodpoved` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `doktor_odpoved_id` bigint(20) NOT NULL,
  `odpoved_id` bigint(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `doktor_odpoved_id_idx` (`doktor_odpoved_id`),
  KEY `odpoved_id_idx` (`odpoved_id`),
  CONSTRAINT `pdpi` FOREIGN KEY (`doktor_odpoved_id`) REFERENCES `pharmalink_doktor_odpoved` (`id`) ON DELETE CASCADE,
  CONSTRAINT `pharmalink_doktor_subodpoved_odpoved_id_pharmalink_odpoved_id` FOREIGN KEY (`odpoved_id`) REFERENCES `pharmalink_odpoved` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `pharmalink_otazka`
ADD `typ` varchar(255) COLLATE 'utf8_unicode_ci' NOT NULL DEFAULT 'radio' AFTER `kampan_id`,
ADD `min_odpovedi` bigint(20) NOT NULL DEFAULT '1' AFTER `typ`,
ADD `max_odpovedi` bigint(20) NOT NULL DEFAULT '0' AFTER `min_odpovedi`,
COMMENT='';