--
-- Host: localhost    Database: taganka-demo
-- ------------------------------------------------------


--
-- Table structure for table `appl_profile_doc`
--

CREATE TABLE `appl_profile_doc` (
  `id_doc` varbinary(36) NOT NULL,
  `id_profile` varbinary(36) NOT NULL,
  `id_doc_type` int(10) unsigned NOT NULL,
  `series` varchar(15) NOT NULL,
  `number` varchar(15) NOT NULL,
  `date_of_issue` date NOT NULL,
  `date_of_expire` date DEFAULT NULL,
  `authority` varchar(150) DEFAULT NULL,
  `subdivision_code` varchar(15) DEFAULT NULL,
  `priority_type` varchar(40) DEFAULT NULL,
  `ldate` timestamp NULL DEFAULT NULL COMMENT 'время загрузки из агент модуля',
  `mdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'время последнего обновления',
  UNIQUE KEY `id_doc` (`id_doc`),
  KEY `id_doc_type` (`id_doc_type`),
  KEY `crm_profile_doc_ibfk_1` (`id_profile`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `appl_profile_doc`
--

INSERT INTO `appl_profile_doc` VALUES ('c837e014-6afe-11e4-a1d2-0050563c3a6d','b79c6fdc-6afe-11e4-a1d2-0050563c3a6d',1,'12121','124288','2003-02-02',NULL,'ааа',NULL,NULL,NULL,'2015-06-25 20:41:34'),('02284678-6b01-11e4-a1d2-0050563c3a6d','e690e802-6b00-11e4-a1d2-0050563c3a6d',1,'1','1','2015-06-12',NULL,NULL,'000-000',NULL,NULL,'2015-06-25 20:41:34'),('6b5cb828-e89e-11e4-a546-0050563c3a6d','6b4183ee-e89e-11e4-a546-0050563c3a6d',1,'1','1','2015-06-12',NULL,NULL,NULL,NULL,NULL,'2015-06-29 08:01:37'),('e983e88e-ef00-11e4-a499-0050563c3a6d','e2646c18-ef00-11e4-a499-0050563c3a6d',1,'8004','247161','2006-10-04',NULL,'Октябрьским рувд гор уфы','022-006',NULL,NULL,'2015-06-25 20:41:34'),('5929b9e6-ff5e-11e4-94b6-e86a5c8ba7a2','10b1d51c-ff5e-11e4-94b6-e86a5c8ba7a2',1,'8002','12345678','2010-01-01',NULL,NULL,NULL,NULL,NULL,'2015-06-25 20:41:34'),('34511f9c-ff69-11e4-94b6-e86a5c8ba7a2','c4e753ed-ff68-11e4-94b6-e86a5c8ba7a2',1,'8002','1234587','2000-02-01',NULL,'опропр',NULL,NULL,NULL,'2015-06-25 20:41:34'),('20b9aaa2-1434-11e5-a5ca-0050563c3a6d','fcfa9279-1433-11e5-a5ca-0050563c3a6d',1,'323423','23423423','0012-12-23','0312-02-13','12312312',NULL,'first',NULL,'2015-06-25 20:41:34'),('31283263-14b1-11e5-a5ca-0050563c3a6d','0deb08ca-14b1-11e5-a5ca-0050563c3a6d',1,'1','1','2015-06-12',NULL,NULL,NULL,NULL,NULL,'2015-06-25 20:41:34'),('8e846fa7-1660-11e5-a5ca-0050563c3a6d','6c60890e-1660-11e5-a5ca-0050563c3a6d',1,'1','1','2015-06-12',NULL,NULL,NULL,NULL,NULL,'2015-06-25 20:41:34');
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `crm_profile_doc_ins` BEFORE INSERT ON `appl_profile_doc` 
											    FOR EACH ROW BEGIN
	IF NEW.id_doc IS NULL OR  NEW.id_doc = 0 THEN
		SET NEW.id_doc = UUID();
	END IF;
    END */;;
DELIMITER ;


