/*
 Navicat Premium Data Transfer

 Source Server         : local
 Source Server Type    : MariaDB
 Source Server Version : 100212
 Source Host           : localhost:3306
 Source Schema         : ceva

 Target Server Type    : MariaDB
 Target Server Version : 100212
 File Encoding         : 65001

 Date: 06/11/2018 16:45:59
*/


-- ----------------------------
-- Table structure for areas
-- ----------------------------
CREATE TABLE `areas`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `is_enabled` int(11) DEFAULT 1,
  `is_blocked` int(11) DEFAULT 0,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `fk_client` int(11) DEFAULT NULL,
  `fk_parent` int(11) DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_clients_id3_idx`(`fk_client`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of areas
-- ----------------------------
INSERT INTO `areas` VALUES (1, 'Area 1_1', 1, 1, '2018-09-26 09:48:45', '2018-10-08 16:58:18', 1, 0);
INSERT INTO `areas` VALUES (2, 'Area 1_2', 1, 0, '2018-09-26 09:48:58', '2018-10-10 18:06:49', 1, 0);
INSERT INTO `areas` VALUES (3, 'Area 1_3', 1, 1, '2018-09-26 09:49:12', '2018-10-15 12:01:45', 1, 0);
INSERT INTO `areas` VALUES (4, 'Area 1_4', 1, 0, '2018-09-26 09:49:28', '2018-10-15 12:10:15', 1, 0);
INSERT INTO `areas` VALUES (5, 'Area 2_1', 1, 0, '2018-09-26 09:49:45', NULL, 2, 0);
INSERT INTO `areas` VALUES (6, 'Area 2_2', 0, 0, '2018-09-26 09:50:03', NULL, 2, 0);
INSERT INTO `areas` VALUES (7, 'Area 3_1', 1, 0, '2018-09-26 16:40:05', NULL, 3, 0);
INSERT INTO `areas` VALUES (8, 'Area 1_5', 1, 0, '2018-09-28 10:22:16', NULL, 1, 0);
INSERT INTO `areas` VALUES (10, 'Area 1_1', 1, 1, '2018-10-08 16:58:25', '2018-10-15 11:59:05', 1, 0);
INSERT INTO `areas` VALUES (12, 'Area 1_1', 1, 0, '2018-10-15 11:59:20', '2018-10-15 11:59:55', 1, 10);
INSERT INTO `areas` VALUES (13, 'Area 1_3_new', 1, 0, '2018-10-15 12:01:48', NULL, 1, 3);
INSERT INTO `areas` VALUES (14, 'Dialisi/Broncosc./Reumat. P1', 1, 0, '2018-11-06 16:44:57', NULL, NULL, 0);
INSERT INTO `areas` VALUES (15, 'Cardiologia P1', 1, 0, '2018-11-06 16:45:18', NULL, NULL, 0);
INSERT INTO `areas` VALUES (16, 'Centro trafusionale PT', 1, 0, '2018-11-06 16:45:19', NULL, NULL, 0);
INSERT INTO `areas` VALUES (17, 'DH Chirurgico P1', 1, 0, '2018-11-06 16:45:19', NULL, NULL, 0);
INSERT INTO `areas` VALUES (18, 'DH Medico P1', 1, 0, '2018-11-06 16:45:19', NULL, NULL, 0);
INSERT INTO `areas` VALUES (19, 'Diabetologia/Mal. met./SIDA PT', 1, 0, '2018-11-06 16:45:19', NULL, NULL, 0);

-- ----------------------------
-- Table structure for auth_assignment
-- ----------------------------
CREATE TABLE `auth_assignment`  (
  `item_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `user_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `created_at` int(11) DEFAULT NULL,
  PRIMARY KEY (`item_name`, `user_id`) USING BTREE,
  INDEX `auth_assignment_user_id_idx`(`user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of auth_assignment
-- ----------------------------
INSERT INTO `auth_assignment` VALUES ('Admin Cliente', '6', 1538139230);
INSERT INTO `auth_assignment` VALUES ('Admin Lotto', '7', 1538139252);
INSERT INTO `auth_assignment` VALUES ('Controllore', '11', 1538491399);
INSERT INTO `auth_assignment` VALUES ('Controllore', '8', 1536673454);
INSERT INTO `auth_assignment` VALUES ('master', '1', 1537786089);
INSERT INTO `auth_assignment` VALUES ('master', '10', 1538129250);
INSERT INTO `auth_assignment` VALUES ('Visualizzatore', '9', 1536673491);

-- ----------------------------
-- Table structure for auth_item
-- ----------------------------
CREATE TABLE `auth_item`  (
  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `type` smallint(6) NOT NULL,
  `description` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
  `rule_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `data` blob,
  `created_at` int(11) DEFAULT NULL,
  `updated_at` int(11) DEFAULT NULL,
  PRIMARY KEY (`name`) USING BTREE,
  INDEX `rule_name`(`rule_name`) USING BTREE,
  INDEX `idx-auth_item-type`(`type`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of auth_item
-- ----------------------------
INSERT INTO `auth_item` VALUES ('Admin Cliente', 1, '', NULL, NULL, 1536673279, 1536673279);
INSERT INTO `auth_item` VALUES ('Admin Lotto', 1, '', 'ownClient', NULL, 1536673291, 1537802885);
INSERT INTO `auth_item` VALUES ('configuration_menu', 2, NULL, NULL, NULL, 1538053883, 1538053883);
INSERT INTO `auth_item` VALUES ('Controllore', 1, '', 'ownClient', NULL, 1536673304, 1537802885);
INSERT INTO `auth_item` VALUES ('draws-checks', 2, 'Permette di sorteggiare i controlli per il periodo selezionato', NULL, NULL, 1541434329, 1541434375);
INSERT INTO `auth_item` VALUES ('is_admin_client', 2, 'Definisce il ruolo admin Cliente', NULL, NULL, 1537862519, 1537862564);
INSERT INTO `auth_item` VALUES ('is_admin_site', 2, 'Definisce il ruolo Admin Lotto', NULL, NULL, 1537862528, 1537862585);
INSERT INTO `auth_item` VALUES ('is_controller', 2, 'Definisce il ruolo Controllore', NULL, NULL, 1537862541, 1537862600);
INSERT INTO `auth_item` VALUES ('is_viewer', 2, NULL, NULL, NULL, 1538487523, 1538487523);
INSERT INTO `auth_item` VALUES ('manage_clients', 2, '- Può gestire i Clienti dell\'applicazione', NULL, NULL, 1537785775, 1537786123);
INSERT INTO `auth_item` VALUES ('master', 1, '', NULL, NULL, 1536225773, 1537786089);
INSERT INTO `auth_item` VALUES ('rbac-manage', 2, '- Abilita alla gestione dei Ruoli\r\n- Abilita alla gestione dei Permessi\r\n- Abilita alla gestione delle assegnazioni dei ruoli\r\n- Abilita l\'anagrafica di tutta l\'applicazione', NULL, NULL, 1536314985, 1537783295);
INSERT INTO `auth_item` VALUES ('registry-manage', 2, NULL, NULL, NULL, 1536315414, 1536315414);
INSERT INTO `auth_item` VALUES ('Visualizzatore', 1, '', 'ownClient', NULL, 1536673317, 1537802885);

-- ----------------------------
-- Table structure for auth_item_child
-- ----------------------------
CREATE TABLE `auth_item_child`  (
  `parent` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `child` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`parent`, `child`) USING BTREE,
  INDEX `child`(`child`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of auth_item_child
-- ----------------------------
INSERT INTO `auth_item_child` VALUES ('Admin Cliente', 'configuration_menu');
INSERT INTO `auth_item_child` VALUES ('Admin Cliente', 'is_admin_client');
INSERT INTO `auth_item_child` VALUES ('Admin Cliente', 'manage_clients');
INSERT INTO `auth_item_child` VALUES ('Admin Lotto', 'configuration_menu');
INSERT INTO `auth_item_child` VALUES ('Admin Lotto', 'is_admin_site');
INSERT INTO `auth_item_child` VALUES ('Controllore', 'draws-checks');
INSERT INTO `auth_item_child` VALUES ('Controllore', 'is_controller');
INSERT INTO `auth_item_child` VALUES ('master', 'configuration_menu');
INSERT INTO `auth_item_child` VALUES ('master', 'draws-checks');
INSERT INTO `auth_item_child` VALUES ('master', 'manage_clients');
INSERT INTO `auth_item_child` VALUES ('master', 'rbac-manage');
INSERT INTO `auth_item_child` VALUES ('master', 'registry-manage');
INSERT INTO `auth_item_child` VALUES ('Visualizzatore', 'is_viewer');

-- ----------------------------
-- Table structure for auth_rule
-- ----------------------------
CREATE TABLE `auth_rule`  (
  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `data` blob,
  `created_at` int(11) DEFAULT NULL,
  `updated_at` int(11) DEFAULT NULL,
  `ruleClass` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`name`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of auth_rule
-- ----------------------------
INSERT INTO `auth_rule` VALUES ('ownClient', 0x4F3A32323A226170705C726261635C4F776E436C69656E7452756C65223A333A7B733A343A226E616D65223B733A393A226F776E436C69656E74223B733A393A22637265617465644174223B693A313533373830323838353B733A393A22757064617465644174223B693A313533373830323838353B7D, 1537802885, 1537802885, 'app\\rbac\\OwnClientRule');

-- ----------------------------
-- Table structure for checks
-- ----------------------------
CREATE TABLE `checks`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `is_positive` int(11) DEFAULT NULL,
  `is_missing` int(11) DEFAULT 0,
  `note` text CHARACTER SET latin1 COLLATE latin1_swedish_ci,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `fk_user` int(11) DEFAULT NULL,
  `fk_element` int(11) DEFAULT NULL,
  `fk_distribution` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_users_id2_idx`(`fk_user`) USING BTREE,
  INDEX `fk_distribution_has_grid_id3_idx`(`fk_distribution`) USING BTREE,
  INDEX `fk_elements_id3_idx`(`fk_element`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for clients
-- ----------------------------
CREATE TABLE `clients`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `is_enabled` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of clients
-- ----------------------------
INSERT INTO `clients` VALUES (1, 'Cliente 1', '2018-09-24 12:48:57', '2018-09-24 16:31:38', 1);
INSERT INTO `clients` VALUES (2, 'Cliente 2', '2018-09-24 12:49:03', NULL, 1);
INSERT INTO `clients` VALUES (3, 'Cliente 3', '2018-09-24 12:49:58', NULL, 1);
INSERT INTO `clients` VALUES (4, 'Cliente 4', '2018-09-24 15:42:54', '2018-09-24 17:17:26', 0);

-- ----------------------------
-- Table structure for criteria
-- ----------------------------
CREATE TABLE `criteria`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `operator` varchar(5) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `threshold` int(11) DEFAULT NULL,
  `unit_of_measure` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `is_basic_element` int(11) DEFAULT 0 COMMENT 'Element that can be duplicate',
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `fk_element` int(11) DEFAULT NULL,
  `fk_copy` int(11) DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_elements_id2_idx`(`fk_element`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 150 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of criteria
-- ----------------------------
INSERT INTO `criteria` VALUES (116, 'Criterio 1_13', '<', 2, '', 0, '2018-10-31 10:08:42', '2018-11-05 12:09:14', 124, 0);
INSERT INTO `criteria` VALUES (117, 'Criterio 1_3', '<', 3, '', 0, '2018-10-31 10:08:47', '2018-10-31 10:09:28', 124, 116);
INSERT INTO `criteria` VALUES (118, 'Criterio 1_4', 'abs', 4, '', 0, '2018-10-31 10:08:48', '2018-10-31 10:09:31', 124, 116);
INSERT INTO `criteria` VALUES (119, 'Criterio 1_1', '>', 2, '', 0, '2018-10-31 10:11:58', '2018-10-31 10:11:58', 134, 116);
INSERT INTO `criteria` VALUES (120, 'Criterio 1_3', '<', 3, '', 0, '2018-10-31 10:11:58', '2018-10-31 10:11:58', 134, 117);
INSERT INTO `criteria` VALUES (121, 'Criterio 1_4', 'abs', 4, '', 0, '2018-10-31 10:11:58', '2018-10-31 10:11:58', 134, 118);
INSERT INTO `criteria` VALUES (127, 'Criterio 1_1_1', '<=', 4, 'mm', 0, '2018-10-31 18:25:05', NULL, 128, 0);
INSERT INTO `criteria` VALUES (128, 'Criterio 1_1', '>', 2, '', 0, '2018-10-31 18:26:16', '2018-10-31 18:26:16', 125, 116);
INSERT INTO `criteria` VALUES (129, 'Criterio 1_4', 'abs', 4, '', 0, '2018-10-31 18:26:19', '2018-10-31 18:26:19', 125, 118);
INSERT INTO `criteria` VALUES (130, 'Criterio 1_1_1', '<=', 4, 'mm', 0, '2018-10-31 18:26:19', '2018-10-31 18:26:19', 125, 127);
INSERT INTO `criteria` VALUES (135, 'Criterio 1_4', 'abs', 4, '', 0, '2018-11-05 12:02:00', '2018-11-05 12:02:00', 125, 118);
INSERT INTO `criteria` VALUES (136, 'Criterio 1_1', '>', 2, '', 0, '2018-11-05 12:02:35', '2018-11-05 12:02:35', 138, 128);
INSERT INTO `criteria` VALUES (137, 'Criterio 1_4', 'abs', 4, '', 0, '2018-11-05 12:02:35', '2018-11-05 12:02:35', 138, 129);
INSERT INTO `criteria` VALUES (138, 'Criterio 1_1_1', '<=', 4, 'mm', 0, '2018-11-05 12:02:35', '2018-11-05 12:02:35', 138, 130);
INSERT INTO `criteria` VALUES (139, 'Criterio 1_4', 'abs', 4, '', 0, '2018-11-05 12:02:35', '2018-11-05 12:02:35', 138, 135);
INSERT INTO `criteria` VALUES (140, 'Criterio 1_1_1', '<=', 4, 'mm', 0, '2018-11-05 12:02:57', '2018-11-05 12:02:57', 138, 130);
INSERT INTO `criteria` VALUES (141, 'Criterio 1_4', 'abs', 4, '', 0, '2018-11-05 12:02:57', '2018-11-05 12:02:57', 138, 129);
INSERT INTO `criteria` VALUES (142, 'Criterio 1_3', '<', 3, '', 0, '2018-11-05 12:02:57', '2018-11-05 12:02:57', 138, 117);
INSERT INTO `criteria` VALUES (143, 'Criterio 1_1', '>', 2, '', 0, '2018-11-05 12:05:53', '2018-11-05 12:05:53', 124, 116);
INSERT INTO `criteria` VALUES (144, 'Criterio 1_1', '>', 2, '', 0, '2018-11-05 12:06:54', '2018-11-05 12:06:54', 129, 116);
INSERT INTO `criteria` VALUES (145, 'Criterio 1_1', '>', 2, '', 0, '2018-11-05 12:06:54', '2018-11-05 12:06:54', 129, 143);
INSERT INTO `criteria` VALUES (146, 'Criterio 1_3', '<', 3, '', 0, '2018-11-05 12:06:54', '2018-11-05 12:06:54', 129, 117);
INSERT INTO `criteria` VALUES (147, 'Criterio 1_4', 'abs', 4, '', 0, '2018-11-05 12:06:54', '2018-11-05 12:06:54', 129, 118);
INSERT INTO `criteria` VALUES (148, 'Criterio 1_1', '>', 2, '', 0, '2018-11-05 12:11:09', '2018-11-05 12:11:09', 138, 143);
INSERT INTO `criteria` VALUES (149, 'Criterio 1_13', '<', 2, '', 0, '2018-11-05 12:11:10', '2018-11-05 12:11:10', 138, 116);

-- ----------------------------
-- Table structure for distribution_grids
-- ----------------------------
CREATE TABLE `distribution_grids`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `number_zones` int(11) DEFAULT NULL,
  `samples` int(11) DEFAULT NULL,
  `max_per_area` int(11) DEFAULT NULL,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `fk_distribution` int(11) DEFAULT NULL,
  `fk_grid` int(11) DEFAULT NULL,
  `fk_period` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_distributions_id1_idx`(`fk_distribution`) USING BTREE,
  INDEX `fk_grids_id2_idx`(`fk_grid`) USING BTREE,
  INDEX `fk_periods_id2_idx`(`fk_period`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of distribution_grids
-- ----------------------------
INSERT INTO `distribution_grids` VALUES (22, 15, 2, 10, '2018-10-31 12:19:01', '2018-10-31 12:21:52', 1, 1, 1);
INSERT INTO `distribution_grids` VALUES (23, 3, 1, 10, '2018-10-31 12:19:01', '2018-10-31 12:21:52', 1, 5, 1);
INSERT INTO `distribution_grids` VALUES (24, 9, 3, 10, '2018-10-31 12:19:01', '2018-10-31 12:21:52', 1, 7, 1);
INSERT INTO `distribution_grids` VALUES (25, 15, 5, 10, '2018-10-31 12:19:01', '2018-10-31 12:21:52', 1, 25, 1);

-- ----------------------------
-- Table structure for distribution_has_areas
-- ----------------------------
CREATE TABLE `distribution_has_areas`  (
  `fk_distribution_grid` int(11) NOT NULL,
  `fk_area` int(11) NOT NULL,
  PRIMARY KEY (`fk_distribution_grid`, `fk_area`) USING BTREE,
  INDEX `fk_areas_id1_idx`(`fk_area`) USING BTREE,
  CONSTRAINT `areaOwnByGrid` FOREIGN KEY (`fk_distribution_grid`) REFERENCES `distribution_grids` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of distribution_has_areas
-- ----------------------------
INSERT INTO `distribution_has_areas` VALUES (22, 12);
INSERT INTO `distribution_has_areas` VALUES (23, 2);
INSERT INTO `distribution_has_areas` VALUES (24, 12);
INSERT INTO `distribution_has_areas` VALUES (25, 2);
INSERT INTO `distribution_has_areas` VALUES (25, 7);
INSERT INTO `distribution_has_areas` VALUES (25, 12);
INSERT INTO `distribution_has_areas` VALUES (25, 13);

-- ----------------------------
-- Table structure for distribution_has_zones
-- ----------------------------
CREATE TABLE `distribution_has_zones`  (
  `fk_distribution_grid` int(11) NOT NULL,
  `fk_zone` int(11) NOT NULL,
  PRIMARY KEY (`fk_distribution_grid`, `fk_zone`) USING BTREE,
  INDEX `fk_zonas_id1_idx`(`fk_zone`) USING BTREE,
  CONSTRAINT `zoneOwnByGrid` FOREIGN KEY (`fk_distribution_grid`) REFERENCES `distribution_grids` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of distribution_has_zones
-- ----------------------------
INSERT INTO `distribution_has_zones` VALUES (22, 14);
INSERT INTO `distribution_has_zones` VALUES (22, 16);
INSERT INTO `distribution_has_zones` VALUES (22, 17);
INSERT INTO `distribution_has_zones` VALUES (23, 3);
INSERT INTO `distribution_has_zones` VALUES (24, 7);
INSERT INTO `distribution_has_zones` VALUES (24, 9);
INSERT INTO `distribution_has_zones` VALUES (24, 15);
INSERT INTO `distribution_has_zones` VALUES (25, 2);
INSERT INTO `distribution_has_zones` VALUES (25, 4);
INSERT INTO `distribution_has_zones` VALUES (25, 6);
INSERT INTO `distribution_has_zones` VALUES (25, 8);
INSERT INTO `distribution_has_zones` VALUES (25, 10);
INSERT INTO `distribution_has_zones` VALUES (25, 12);
INSERT INTO `distribution_has_zones` VALUES (25, 18);

-- ----------------------------
-- Table structure for distributions
-- ----------------------------
CREATE TABLE `distributions`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sort_by_grid` int(11) DEFAULT 0,
  `sort_by_area` int(11) DEFAULT 0,
  `total_population` int(11) DEFAULT NULL,
  `total_checks` int(11) DEFAULT NULL,
  `num_choises` int(11) DEFAULT NULL,
  `threshold_acceptability` int(11) DEFAULT NULL,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `is_enabled` int(11) DEFAULT 1,
  `is_active` int(11) DEFAULT 0,
  `fk_site` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_sites_id4_idx`(`fk_site`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of distributions
-- ----------------------------
INSERT INTO `distributions` VALUES (1, 1, 0, 42, 10, 11, 3, '2018-10-31 12:19:01', NULL, 1, 1, 1);

-- ----------------------------
-- Table structure for elements
-- ----------------------------
CREATE TABLE `elements`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `coefficient` int(11) DEFAULT NULL,
  `liv` int(11) DEFAULT 0,
  `coefficent_check` int(11) DEFAULT 0,
  `is_basic_element` int(11) DEFAULT 0 COMMENT 'Element that can be duplicate',
  `is_blocked` int(11) DEFAULT 0,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `fk_element` int(11) DEFAULT 0,
  `fk_grid` int(11) DEFAULT NULL,
  `fk_copy` int(11) DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_elements_id1_idx`(`fk_element`, `id`) USING BTREE,
  INDEX `fk_grids_id1_idx`(`fk_grid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 139 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of elements
-- ----------------------------
INSERT INTO `elements` VALUES (124, 'Elemento 1_1', 1, 0, 0, 0, 0, '2018-10-31 10:04:42', '2018-10-31 11:49:17', 0, 1, 0);
INSERT INTO `elements` VALUES (125, 'Elemento 1_4', 2, 0, 0, 0, 0, '2018-10-31 10:04:46', '2018-10-31 10:11:23', 0, 1, 124);
INSERT INTO `elements` VALUES (128, 'Elemento 1_1_1', 2, 1, 0, 0, 0, '2018-10-31 10:05:48', '2018-10-31 10:11:23', 124, 1, 0);
INSERT INTO `elements` VALUES (129, 'Elemento 1_1_2', 2, 1, 0, 0, 0, '2018-10-31 10:05:54', '2018-10-31 10:11:29', 124, 1, 128);
INSERT INTO `elements` VALUES (131, 'Elemento 1_2', 1, 0, 0, 0, 0, '2018-10-31 10:07:09', '2018-10-31 10:07:43', 0, 25, 124);
INSERT INTO `elements` VALUES (132, 'Elemento 1_1_1', 2, 1, 0, 0, 0, '2018-10-31 10:07:09', '2018-10-31 10:07:32', 131, 25, 128);
INSERT INTO `elements` VALUES (133, 'Elemento 1_1_2', 2, 1, 0, 0, 0, '2018-10-31 10:07:09', '2018-10-31 10:07:37', 131, 25, 129);
INSERT INTO `elements` VALUES (134, 'Elemento 1_1', 1, 0, 0, 0, 0, '2018-10-31 10:11:58', '2018-10-31 10:11:58', 0, 26, 124);
INSERT INTO `elements` VALUES (135, 'Elemento 1_1_2', 2, 1, 0, 0, 0, '2018-10-31 10:11:58', '2018-10-31 10:12:28', 134, 26, 128);
INSERT INTO `elements` VALUES (136, 'Elemento 1_1_3', 2, 1, 0, 0, 0, '2018-10-31 10:11:58', '2018-10-31 10:12:33', 134, 26, 129);
INSERT INTO `elements` VALUES (137, 'Elemento 1_4', 2, 0, 0, 0, 0, '2018-10-31 10:11:58', '2018-10-31 10:11:58', 0, 26, 125);
INSERT INTO `elements` VALUES (138, 'Elemento 1_4_(2)', 2, 0, 0, 0, 0, '2018-11-05 12:02:35', '2018-11-05 12:02:35', 0, 1, 125);

-- ----------------------------
-- Table structure for grids
-- ----------------------------
CREATE TABLE `grids`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `threshold` double DEFAULT NULL,
  `is_basic_element` int(11) DEFAULT 0 COMMENT 'Element that can be duplicate',
  `is_enabled` int(11) DEFAULT 1,
  `is_blocked` int(11) DEFAULT 0,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `fk_client` int(11) DEFAULT NULL,
  `fk_parent` int(11) DEFAULT 0,
  `fk_copy` int(11) DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_clients_id2_idx`(`fk_client`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of grids
-- ----------------------------
INSERT INTO `grids` VALUES (1, 'Griglia 1_1', 0.7, 1, 1, 0, '2018-09-26 16:07:22', '2018-10-31 10:10:47', 1, 0, 0);
INSERT INTO `grids` VALUES (4, 'Griglia 2_1', 0.1, 1, 1, 0, '2018-09-26 16:09:13', '2018-10-08 15:29:54', 2, 0, 0);
INSERT INTO `grids` VALUES (5, 'Griglia 2_2', 0.55, 1, 1, 0, '2018-09-26 16:09:29', '2018-10-08 15:29:54', 2, 0, 0);
INSERT INTO `grids` VALUES (6, 'Griglia 3_1', 0.88, 1, 1, 0, '2018-09-26 16:09:54', '2018-10-08 15:29:54', 3, 0, 0);
INSERT INTO `grids` VALUES (7, 'Griglia 3_2', 0.95, 1, 1, 0, '2018-09-26 16:10:12', '2018-10-08 15:29:58', 3, 0, 0);
INSERT INTO `grids` VALUES (25, 'Griglia 1_1_(1)', 0.7, 1, 1, 0, '2018-10-31 10:11:58', '2018-10-31 11:53:59', 1, 0, 1);

-- ----------------------------
-- Table structure for import_temporary
-- ----------------------------
CREATE TABLE `import_temporary`  (
  `zone` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `n_zone` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `cod_zone` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `cod_grid` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `grid` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `site` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `cod_area` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `area` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `floor` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `detail` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of import_temporary
-- ----------------------------
INSERT INTO `import_temporary` VALUES ('AMB. PSICOLOGIA', '3', 'AM', '', 'Ambulatori MRRRR', 'DEMO OSPEDALIERO', '', 'Dialisi/Broncosc./Reumat. P1', '', '\r');
INSERT INTO `import_temporary` VALUES ('AMBULATORIO', '5', 'AM', '', 'Ambulatori MRRRR', 'DEMO OSPEDALIERO', '', 'Cardiologia P1', '', '\r');
INSERT INTO `import_temporary` VALUES ('AMBULATORIO', '3', 'AM', '', 'Ambulatori MRRRR', 'DEMO OSPEDALIERO', '', 'Centro trafusionale PT', '', '\r');
INSERT INTO `import_temporary` VALUES ('AMBULATORIO', '4', 'AM', '', 'Ambulatori MRRRR', 'DEMO OSPEDALIERO', '', 'DH Chirurgico P1', '', '\r');
INSERT INTO `import_temporary` VALUES ('AMBULATORIO', '4', 'AM', '', 'Ambulatori MRRRR', 'DEMO OSPEDALIERO', '', 'DH Medico P1', '', '\r');
INSERT INTO `import_temporary` VALUES ('AMBULATORIO', '13', 'AM', '', 'Ambulatori MRRRR', 'DEMO OSPEDALIERO', '', 'Diabetologia/Mal. met./SIDA PT', '', '\r');

-- ----------------------------
-- Table structure for medias
-- ----------------------------
CREATE TABLE `medias`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `filename` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `path` varchar(300) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `size` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `mime_type` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `fk_insert_by` int(11) NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of medias
-- ----------------------------
INSERT INTO `medias` VALUES (1, 'f32a7cf6b07828f608d67788d34aaecc2d2952cc.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 12:16:42', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (2, 'fb1e9feeeda757304b9fc8c4f6e0e78ceb2045b0.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 12:33:59', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (3, '182bed198e352e2488d0b2a0663708c978ad8c56.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 12:40:32', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (4, '03756557c851dda0c0375e0b793e4acd939cf6e3.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 12:42:27', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (5, '9e7658e5e22ab29a3b3cd7848e66b4f103f8e4c9.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 12:42:46', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (6, 'ba6b9eabdce6c12b3339f5e9a9f04e98c9d3f1e4.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 12:43:03', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (7, '0d30d7448be581e52669a606aaff69aaf137a88f.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 12:43:25', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (8, '8b3da0f9ea0d5ec2042f5e417d98897039019dfb.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:13:51', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (9, '3cbb4260dd6431a76bf61c79f8009c034de6f107.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:15:30', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (10, '1e3eedc7d5baee261bb69e099feddab60dd633c6.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:16:04', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (11, '5cacb4e959ff54bfd67ee7740f058b016044af1b.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:17:42', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (12, '2e0c504b0018210801cec30ea309e84acfb8e16d.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:18:45', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (13, '236c279aff4bdbc44e162bde3cd249b2614bdf8a.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:22:09', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (14, 'c9cfc3c29c99be96c52c5f7812d92867cd6eca57.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:22:44', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (15, 'ac058740854a75179843328aae1b4ccb85fdbd3c.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:23:09', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (16, 'effed2e9459ec6bca2b07d263bc4a690f2883339.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:23:20', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (17, 'a0d4c97708562c7d714f123e49bdc4295fdb0fff.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:27:11', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (18, '1dc5c6136c4e015d3e156a46180d9d0ba21a09a0.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:27:30', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (19, 'afbae32693dba2847c13e357742bf76f37e768aa.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:28:09', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (20, '99d0da646436e0d6bc6da79eef848652efbbf24e.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:29:17', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (21, '39b870c41d43c4dc0d87f985f9058edb2a19c660.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\', '469 ', '2018-11-06 15:29:41', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (22, 'd623cc43c75be638135b0b25225e413a7cd6e29e.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 15:39:14', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (23, 'bc9d00b71d8c282d4ea308c6e9bc79828ea8ddb2.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 15:39:45', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (24, '4e79074d9b57a81bca2aff692412a7c5a23e460b.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:30:31', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (25, '5023ee3822dbb6703600ae894453c1506a7e68fe.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:31:05', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (26, '74baaf68f5d6b4b3ac41be820e93c5d6f8f3455a.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:31:28', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (27, 'cf3b3e1cd4a9d20d6a98a7ef8cfa4f1b0afda28c.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:41:22', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (28, '1d74b0adb7a87e661174ee6f6838372dd259e350.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:41:37', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (29, '649fb307b754f29522a763ee6d1ccae2ab584512.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:41:59', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (30, 'f5a66a17efbb32a2adb0ed40a7e3a7e239900878.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:42:40', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (31, '4ab5d9cf2b32874cf6f1714b04c643e58e71bd68.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:43:26', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (32, '17d8c22b487c0eb92c947c9678535a0e68e10f3d.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:44:27', 'application/vnd.ms-excel', 1);
INSERT INTO `medias` VALUES (33, '7cfe06c8461fccb3462ee142d63272896a89faa0.csv', 'C:\\xampp\\htdocs\\Ceva\\web\\media\\', '469 ', '2018-11-06 16:44:44', 'application/vnd.ms-excel', 1);

-- ----------------------------
-- Table structure for migration
-- ----------------------------
CREATE TABLE `migration`  (
  `version` varchar(180) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `apply_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`version`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of migration
-- ----------------------------
INSERT INTO `migration` VALUES ('m000000_000000_base', 1536073152);
INSERT INTO `migration` VALUES ('m180904_145824_init_rbac', 1536073154);

-- ----------------------------
-- Table structure for periods
-- ----------------------------
CREATE TABLE `periods`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `start_dt` date DEFAULT NULL,
  `end_dt` date DEFAULT NULL,
  `is_active` int(11) DEFAULT 1,
  `is_enabled` int(11) DEFAULT 1,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `close_dttm` datetime(0) DEFAULT NULL,
  `fk_site` int(11) DEFAULT NULL,
  `fk_distribution` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_site_index`(`fk_site`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of periods
-- ----------------------------
INSERT INTO `periods` VALUES (1, '2018-10-31', '2018-11-30', 1, 1, '2018-10-31 12:21:52', NULL, NULL, 1, 1);

-- ----------------------------
-- Table structure for periods_type
-- ----------------------------
CREATE TABLE `periods_type`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `days` int(11) DEFAULT NULL,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of periods_type
-- ----------------------------
INSERT INTO `periods_type` VALUES (1, 'Mensile', 30, '2018-09-27 10:00:55', '2018-09-27 10:03:07');
INSERT INTO `periods_type` VALUES (2, 'Semestrale', 180, '2018-09-27 10:01:04', '2018-09-27 10:03:07');
INSERT INTO `periods_type` VALUES (3, 'Annuale', 365, '2018-09-27 15:31:52', NULL);

-- ----------------------------
-- Table structure for site_has_controller
-- ----------------------------
CREATE TABLE `site_has_controller`  (
  `fk_site` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL,
  PRIMARY KEY (`fk_site`, `fk_user`) USING BTREE,
  INDEX `fk_users_id1_idx`(`fk_user`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of site_has_controller
-- ----------------------------
INSERT INTO `site_has_controller` VALUES (1, 11);

-- ----------------------------
-- Table structure for sites
-- ----------------------------
CREATE TABLE `sites`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `description` text CHARACTER SET latin1 COLLATE latin1_swedish_ci,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `is_enabled` int(11) DEFAULT 1,
  `is_blocked` int(11) DEFAULT 0,
  `fk_client` int(11) DEFAULT NULL,
  `fk_period_type` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_clients_id4_idx`(`fk_client`) USING BTREE,
  INDEX `fk_period_id_idx`(`fk_period_type`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sites
-- ----------------------------
INSERT INTO `sites` VALUES (1, 'Lotto 1_1', 'Questo è il primo lotto creato', '2018-09-24 16:26:21', '2018-09-27 10:02:20', 1, 0, 1, 1);
INSERT INTO `sites` VALUES (2, 'Lotto 2_1', 'Questo è un lotto creato per il secondo cliente', '2018-09-24 17:42:18', '2018-09-27 10:02:38', 1, 0, 2, 1);
INSERT INTO `sites` VALUES (3, 'Lotto 1_2', 'Questo è un secondo lotto di test per il cliente 1', '2018-09-24 17:42:47', '2018-09-27 10:02:43', 0, 0, 1, 2);
INSERT INTO `sites` VALUES (4, 'Lotto 1_3', 'Questo è il 3 lotto creato per il cliente 1', '2018-09-24 17:48:57', '2018-09-27 10:02:38', 1, 0, 1, 1);
INSERT INTO `sites` VALUES (5, 'Lotto 3_1', 'Questo è il primo lotto del cliente 3', '2018-09-24 17:49:34', '2018-09-27 10:02:38', 1, 0, 3, 1);
INSERT INTO `sites` VALUES (6, 'DEMO OSPEDALIERO', 'Lotto di prova', '2018-11-06 15:50:11', NULL, 1, 0, 1, 2);

-- ----------------------------
-- Table structure for zones
-- ----------------------------
CREATE TABLE `zones`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `number` int(11) DEFAULT NULL,
  `code` varchar(45) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `create_dttm` datetime(0) DEFAULT current_timestamp(),
  `update_dttm` datetime(0) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  `is_enabled` int(11) DEFAULT 1,
  `is_blocked` int(11) DEFAULT 0,
  `fk_site` int(11) DEFAULT NULL,
  `fk_area` int(11) DEFAULT NULL,
  `fk_grid` int(11) DEFAULT NULL,
  `fk_parent` int(11) DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_sites_id1_idx`(`fk_site`) USING BTREE,
  INDEX `fk_areas_id2_idx`(`fk_area`) USING BTREE,
  INDEX `fk_grids_id3_idx`(`fk_grid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of zones
-- ----------------------------
INSERT INTO `zones` VALUES (1, 'Zona 1_1', 10, 'Z1', '2018-09-26 16:24:05', '2018-10-31 11:54:18', 1, 1, 1, 12, 4, 0);
INSERT INTO `zones` VALUES (2, 'Zona 1_2', 2, 'Z2', '2018-09-26 16:38:45', '2018-10-31 11:53:42', 1, 0, 1, 2, 25, 0);
INSERT INTO `zones` VALUES (3, 'Zona 1_3', 3, 'Z3', '2018-09-26 16:39:16', '2018-10-31 11:54:19', 1, 0, 1, 2, 5, 0);
INSERT INTO `zones` VALUES (4, 'Zona 3_1', 4, 'Z4', '2018-09-26 16:40:25', '2018-10-31 11:53:20', 1, 0, 5, 7, 25, 0);
INSERT INTO `zones` VALUES (5, 'Zona 1_6', 2, 'Z6', '2018-10-03 11:25:49', '2018-10-31 11:54:21', 1, 1, 1, 13, 6, 0);
INSERT INTO `zones` VALUES (6, 'Zona 1_7', 4, 'Z7', '2018-10-03 11:26:12', '2018-10-30 18:19:49', 1, 0, 1, 12, 25, 0);
INSERT INTO `zones` VALUES (7, 'Zona 1_8', 7, 'Z8', '2018-10-03 11:26:42', '2018-10-31 11:54:21', 1, 0, 1, 12, 7, 0);
INSERT INTO `zones` VALUES (8, 'Zona 1_9', 5, 'Z9', '2018-10-03 11:27:26', '2018-10-31 11:53:22', 0, 0, 1, 2, 25, 0);
INSERT INTO `zones` VALUES (9, 'Zona 1_10', 4, 'Z10', '2018-10-04 12:16:04', '2018-10-31 11:54:22', 1, 1, 1, 12, 7, 0);
INSERT INTO `zones` VALUES (10, 'Zona 1_11', 5, 'Z11', '2018-10-04 15:26:26', '2018-10-31 11:53:24', 1, 0, 1, 12, 25, 0);
INSERT INTO `zones` VALUES (11, 'Zona 1_12', 2, 'Z12', '2018-10-04 16:21:56', '2018-10-31 11:54:23', 0, 0, 1, 8, 4, 0);
INSERT INTO `zones` VALUES (12, 'Zona 1_13', 2, 'Z13', '2018-10-08 10:05:17', '2018-10-30 18:19:49', 1, 1, 1, 12, 25, 0);
INSERT INTO `zones` VALUES (13, 'Zona 1_14', 1, 'Z14', '2018-10-08 10:11:08', '2018-10-31 11:54:27', 1, 1, 1, 12, 4, 0);
INSERT INTO `zones` VALUES (14, 'Zona 1_1_oA', 10, 'Z1', '2018-09-26 16:24:05', '2018-10-31 11:54:38', 1, 0, 1, 12, 1, 0);
INSERT INTO `zones` VALUES (15, 'Zona 1_13_n', 2, 'Z13', '2018-10-08 10:05:17', '2018-10-31 11:54:29', 1, 0, 1, 12, 7, 0);
INSERT INTO `zones` VALUES (16, 'Zona 1_10_new', 4, 'Z10', '2018-10-04 12:16:04', '2018-10-31 11:54:37', 1, 0, 1, 12, 1, 9);
INSERT INTO `zones` VALUES (17, 'Zona 1_14', 1, 'Z14', '2018-10-08 10:11:08', '2018-10-31 11:54:37', 1, 0, 1, 12, 1, 13);
INSERT INTO `zones` VALUES (18, 'Zona 1_6_new', 4, 'Z6', '2018-10-03 11:25:49', '2018-10-30 18:19:49', 1, 0, 1, 13, 25, 5);

