


/*Table structure for table `migrations` */






CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



/*Data for the table `migrations` */



insert  into `migrations`(`id`,`migration`,`batch`) values (1,'2014_10_12_000000_create_users_admin_table',1),(2,'2014_10_12_100000_create_password_reset_tokens_table',1),(3,'2014_10_12_200000_add_two_factor_columns_to_users_table',1),(4,'2019_08_19_000000_create_failed_jobs_table',1),(5,'2019_12_14_000001_create_personal_access_tokens_table',1),(6,'2023_02_27_214449_create_sessions_table',1),(7,'2023_04_05_191906_create_permission_tables',1),(8,'2023_12_01_174955_create_infoauto_procesos_table',2);



/*Table structure for table `model_has_permissions` */






CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



/*Data for the table `model_has_permissions` */



/*Table structure for table `model_has_roles` */






CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) unsigned NOT NULL,
  `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



/*Data for the table `model_has_roles` */



insert  into `model_has_roles`(`role_id`,`model_type`,`model_id`) values (1,'App\\Models\\User',1),(1,'App\\Models\\User',2),(2,'App\\Models\\User',2),(2,'App\\Models\\User',3),(2,'App\\Models\\User',4);



/*Table structure for table `permissions` */






CREATE TABLE `permissions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `modulo` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'general',
  `operacion` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nombre` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `guard_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`),
  KEY `permissions_modulo_index` (`modulo`),
  KEY `permissions_nombre_index` (`nombre`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



/*Data for the table `permissions` */



insert  into `permissions`(`id`,`name`,`modulo`,`operacion`,`nombre`,`guard_name`,`created_at`,`updated_at`) values (1,'admin_permisos:alta','admin','Alta','Permisos','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(2,'admin_permisos:baja','admin','Baja','Permisos','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(3,'admin_permisos:modif','admin','Modif','Permisos','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(4,'admin_permisos:lectura','admin','Lectura','Permisos','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(5,'admin_roles:alta','admin','Alta','Roles','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(6,'admin_roles:baja','admin','Baja','Roles','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(7,'admin_roles:modif','admin','Modif','Roles','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(8,'admin_roles:lectura','admin','Lectura','Roles','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(9,'admin_usuarios:alta','admin','Alta','Usuarios','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(10,'admin_usuarios:baja','admin','Baja','Usuarios','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(11,'admin_usuarios:modif','admin','Modif','Usuarios','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(12,'admin_usuarios:lectura','admin','Lectura','Usuarios','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(13,'admin_tipo-entidades:alta','admin','Alta','Tipo Entidades','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(14,'admin_tipo-entidades:baja','admin','Baja','Tipo Entidades','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(15,'admin_tipo-entidades:modif','admin','Modif','Tipo Entidades','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(16,'admin_tipo-entidades:lectura','admin','Lectura','Tipo Entidades','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(17,'admin_aseguradoras:alta','admin','Alta','Aseguradoras','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(18,'admin_aseguradoras:baja','admin','Baja','Aseguradoras','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(19,'admin_aseguradoras:modif','admin','Modif','Aseguradoras','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(20,'admin_aseguradoras:lectura','admin','Lectura','Aseguradoras','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(21,'admin_personas:alta','admin','Alta','Personas','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(22,'admin_personas:baja','admin','Baja','Personas','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(23,'admin_personas:modif','admin','Modif','Personas','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(24,'admin_personas:lectura','admin','Lectura','Personas','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(25,'gral_perfil:modif','gral','Modif','Perfil','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(26,'gral_perfil:lectura','gral','Lectura','Perfil','web','2024-03-27 19:56:16','2024-03-27 19:56:16'),(38,'admin_entidades:genero','admin','Genero','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(39,'admin_entidades:nacionalidad','admin','Nacionalidad','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(40,'admin_entidades:estado-civil','admin','Estado Civil','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(41,'admin_entidades:tipo-documento','admin','Tipo Documento','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(42,'admin_entidades:tipo-telefono','admin','Tipo Teléfono','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(43,'admin_entidades:tipo-domicilio','admin','Tipo Domicilio','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(44,'admin_entidades:tipo-email','admin','Tipo Email','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(45,'admin_entidades:provincia','admin','Provincia','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(46,'admin_entidades:condicion-iva','admin','Condición IVA','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(47,'admin_entidades:ingresos-brutos','admin','Ingresos Brutos','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(48,'admin_entidades:mes','admin','Mes','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11'),(49,'admin_entidades:tipo-persona','admin','Tipo Persona','Entidades','web','2024-04-05 22:21:11','2024-04-05 22:21:11');



/*Table structure for table `persona_documentos_identidad` */






CREATE TABLE `persona_documentos_identidad` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `persona_id` bigint(20) unsigned NOT NULL,
  `tipo_doc_id` bigint(20) unsigned NOT NULL,
  `numero` varchar(100) NOT NULL,
  `principal` tinyint(1) NOT NULL DEFAULT '1',
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `persona_documentos_identidad_persona_id_foreign` (`persona_id`),
  KEY `persona_documentos_identidad_tipo_doc_id_foreign` (`tipo_doc_id`),
  KEY `persona_documentos_identidad_numero_index` (`numero`),
  KEY `persona_documentos_identidad_principal_index` (`principal`),
  CONSTRAINT `persona_documentos_identidad_persona_id_foreign` FOREIGN KEY (`persona_id`) REFERENCES `personas` (`id`),
  CONSTRAINT `persona_documentos_identidad_tipo_doc_id_foreign` FOREIGN KEY (`tipo_doc_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;



/*Data for the table `persona_documentos_identidad` */



insert  into `persona_documentos_identidad`(`id`,`persona_id`,`tipo_doc_id`,`numero`,`principal`,`updated_at`,`updated_by`,`deleted_at`,`deleted_by`,`created_at`) values (2,2,9,'30007516',1,'2024-04-24 16:53:19',NULL,NULL,NULL,'2024-04-15 18:41:58'),(3,2,10,'1111111113',0,'2024-04-24 16:53:31',NULL,'2024-04-24 16:53:31',NULL,'2024-04-24 16:48:41'),(4,3,9,'30007515',1,'2024-04-29 19:36:38',NULL,NULL,NULL,'2024-04-29 19:36:38');



/*Table structure for table `persona_domicilios` */






CREATE TABLE `persona_domicilios` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `persona_id` bigint(20) unsigned NOT NULL,
  `tipo_domicilio_id` bigint(20) unsigned NOT NULL,
  `calle` varchar(250) NOT NULL,
  `numero` varchar(10) NOT NULL,
  `piso_departamento` varchar(20) DEFAULT NULL,
  `provincia_id` bigint(20) unsigned NOT NULL,
  `localidad_id` int(10) unsigned NOT NULL,
  `codigo_postal` varchar(10) NOT NULL,
  `principal` tinyint(1) NOT NULL DEFAULT '1',
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `persona_domicilios_persona_id_foreign` (`persona_id`),
  KEY `persona_domicilios_tipo_domicilio_id_foreign` (`tipo_domicilio_id`),
  KEY `persona_domicilios_provincia_id_foreign` (`provincia_id`),
  KEY `persona_domicilios_localidad_id_foreign` (`localidad_id`),
  KEY `persona_domicilios_codigo_postal_index` (`codigo_postal`),
  KEY `persona_domicilios_principal_index` (`principal`),
  CONSTRAINT `persona_domicilios_localidad_id_foreign` FOREIGN KEY (`localidad_id`) REFERENCES `localidades` (`id`),
  CONSTRAINT `persona_domicilios_persona_id_foreign` FOREIGN KEY (`persona_id`) REFERENCES `personas` (`id`),
  CONSTRAINT `persona_domicilios_provincia_id_foreign` FOREIGN KEY (`provincia_id`) REFERENCES `entidades` (`id`),
  CONSTRAINT `persona_domicilios_tipo_domicilio_id_foreign` FOREIGN KEY (`tipo_domicilio_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;



/*Data for the table `persona_domicilios` */



insert  into `persona_domicilios`(`id`,`persona_id`,`tipo_domicilio_id`,`calle`,`numero`,`piso_departamento`,`provincia_id`,`localidad_id`,`codigo_postal`,`principal`,`updated_at`,`updated_by`,`deleted_at`,`deleted_by`,`created_at`) values (2,2,23,'Salvador Debenedetti','2378',NULL,31,2560,'1636',0,'2024-04-30 15:28:03',NULL,NULL,NULL,'2024-04-29 17:16:14'),(3,2,24,'Francisco Borges','2836','1A',30,1,'1636',1,'2024-04-30 15:28:03',NULL,NULL,NULL,'2024-04-29 17:16:56');



/*Table structure for table `persona_emails` */






CREATE TABLE `persona_emails` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `persona_id` bigint(20) unsigned NOT NULL,
  `tipo_email_id` bigint(20) unsigned NOT NULL,
  `email` varchar(100) NOT NULL,
  `principal` tinyint(1) NOT NULL DEFAULT '1',
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `persona_emails_persona_id_foreign` (`persona_id`),
  KEY `persona_emails_tipo_email_id_foreign` (`tipo_email_id`),
  KEY `persona_emails_email_index` (`email`),
  KEY `persona_emails_principal_index` (`principal`),
  CONSTRAINT `persona_emails_persona_id_foreign` FOREIGN KEY (`persona_id`) REFERENCES `personas` (`id`),
  CONSTRAINT `persona_emails_tipo_email_id_foreign` FOREIGN KEY (`tipo_email_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4;



/*Data for the table `persona_emails` */



insert  into `persona_emails`(`id`,`persona_id`,`tipo_email_id`,`email`,`principal`,`updated_at`,`updated_by`,`deleted_at`,`deleted_by`,`created_at`) values (2,2,27,'lucasgrzina+1@gmail.com',1,'2024-04-24 12:20:17',NULL,'2024-04-24 12:20:17',NULL,'2024-04-15 18:41:58'),(3,2,28,'lucasgrzina+5@gmail.com',0,'2024-04-24 11:45:21',NULL,'2024-04-24 11:45:21',NULL,'2024-04-23 20:59:20'),(4,2,29,'sasasa@asasasa.com',0,'2024-04-24 11:45:42',NULL,'2024-04-24 11:45:42',NULL,'2024-04-24 08:11:28'),(5,2,27,'lucasgrzina+1@gmail.com',0,'2024-04-24 11:45:48',NULL,'2024-04-24 11:45:48',NULL,'2024-04-24 08:24:21'),(6,2,28,'sasasa@sasa.com',0,'2024-04-24 11:53:17',NULL,'2024-04-24 11:53:17',NULL,'2024-04-24 08:33:46'),(7,2,27,'asasa@sasasa.com',0,'2024-04-24 11:54:00',NULL,'2024-04-24 11:54:00',NULL,'2024-04-24 08:34:44'),(8,2,29,'aass@sasasa.com',1,'2024-04-30 15:26:48',NULL,NULL,NULL,'2024-04-24 08:40:43'),(9,2,28,'ultmos@sasasa.com',0,'2024-04-24 12:35:23',NULL,'2024-04-24 12:35:23',NULL,'2024-04-24 08:49:05'),(10,2,27,'ahora@asasa.com',0,'2024-04-24 11:56:21',NULL,'2024-04-24 11:56:21',NULL,'2024-04-24 08:50:35'),(11,2,27,'otro@asasa.com',0,'2024-04-24 11:46:39',NULL,'2024-04-24 11:46:39',NULL,'2024-04-24 08:51:32'),(12,2,28,'hola@sasa.com',0,'2024-04-24 15:55:06',NULL,'2024-04-24 15:55:06',NULL,'2024-04-24 12:36:38'),(13,2,28,'assa@sasa.com',0,'2024-04-24 15:54:39',NULL,'2024-04-24 15:54:39',NULL,'2024-04-24 15:37:40'),(14,2,28,'terceros@asasa.ocm',0,'2024-04-30 15:26:48',NULL,NULL,NULL,'2024-04-24 15:54:55'),(15,3,27,'lucasgrzina+2@gmail.com',1,'2024-04-29 19:36:38',NULL,NULL,NULL,'2024-04-29 19:36:38');



/*Table structure for table `persona_telefonos` */






CREATE TABLE `persona_telefonos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `persona_id` bigint(20) unsigned NOT NULL,
  `tipo_telefono_id` bigint(20) unsigned NOT NULL,
  `codigo` varchar(20) DEFAULT NULL,
  `numero` varchar(50) NOT NULL,
  `observaciones` varchar(150) DEFAULT NULL,
  `principal` tinyint(1) NOT NULL DEFAULT '1',
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `persona_telefonos_persona_id_foreign` (`persona_id`),
  KEY `persona_telefonos_tipo_telefono_id_foreign` (`tipo_telefono_id`),
  KEY `persona_telefonos_principal_index` (`principal`),
  CONSTRAINT `persona_telefonos_persona_id_foreign` FOREIGN KEY (`persona_id`) REFERENCES `personas` (`id`),
  CONSTRAINT `persona_telefonos_tipo_telefono_id_foreign` FOREIGN KEY (`tipo_telefono_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;



/*Data for the table `persona_telefonos` */



insert  into `persona_telefonos`(`id`,`persona_id`,`tipo_telefono_id`,`codigo`,`numero`,`observaciones`,`principal`,`updated_at`,`updated_by`,`deleted_at`,`deleted_by`,`created_at`) values (2,2,18,'11','34290838',NULL,1,'2024-04-15 18:41:58',NULL,NULL,NULL,'2024-04-15 18:41:58'),(3,2,18,'11','34290838',NULL,0,'2024-04-24 17:53:09',NULL,'2024-04-24 17:53:09',NULL,'2024-04-24 17:52:24'),(4,2,19,'11','2222222','ssssssss',0,'2024-04-24 18:08:45',NULL,NULL,NULL,'2024-04-24 18:08:45'),(5,3,18,'11','3555555',NULL,1,'2024-04-29 19:36:38',NULL,NULL,NULL,'2024-04-29 19:36:38');



/*Data for the table `personal_access_tokens` */



/*Table structure for table `personas` */






CREATE TABLE `personas` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `apellido` varchar(100) DEFAULT NULL,
  `nombre` varchar(100) DEFAULT NULL,
  `fecha_nacimiento` date DEFAULT NULL,
  `genero_id` bigint(20) unsigned DEFAULT NULL,
  `nacionalidad_id` bigint(20) unsigned DEFAULT NULL,
  `estado_civil_id` bigint(20) unsigned DEFAULT NULL,
  `condicion_iva_id` bigint(20) unsigned DEFAULT NULL,
  `idExterno` bigint(20) DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  `tipo_persona_id` bigint(20) unsigned NOT NULL COMMENT 'Fisica / Empresa',
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `idExterno_UNIQUE` (`idExterno`),
  KEY `personas_genero_id_foreign` (`genero_id`),
  KEY `personas_nacionalidad_id_foreign` (`nacionalidad_id`),
  KEY `personas_estado_civil_id_foreign` (`estado_civil_id`),
  KEY `personas_condicion_iva_id_index` (`condicion_iva_id`),
  KEY `FK_personas_tipo_persona_id_idx` (`tipo_persona_id`),
  CONSTRAINT `FK_personas_tipo_persona_id` FOREIGN KEY (`tipo_persona_id`) REFERENCES `entidades` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `personas_condicion_iva_id_foreign` FOREIGN KEY (`condicion_iva_id`) REFERENCES `entidades` (`id`),
  CONSTRAINT `personas_estado_civil_id_foreign` FOREIGN KEY (`estado_civil_id`) REFERENCES `entidades` (`id`),
  CONSTRAINT `personas_genero_id_foreign` FOREIGN KEY (`genero_id`) REFERENCES `entidades` (`id`),
  CONSTRAINT `personas_nacionalidad_id_foreign` FOREIGN KEY (`nacionalidad_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;



/*Data for the table `personas` */



insert  into `personas`(`id`,`apellido`,`nombre`,`fecha_nacimiento`,`genero_id`,`nacionalidad_id`,`estado_civil_id`,`condicion_iva_id`,`idExterno`,`updated_at`,`updated_by`,`deleted_at`,`deleted_by`,`tipo_persona_id`,`created_at`) values (2,'Grzinas','Lucass','2024-04-15',1,4,6,59,NULL,'2024-04-30 15:26:29',NULL,NULL,NULL,77,'2024-04-15 18:41:58'),(3,'Almeida','Agus','1983-02-12',1,3,6,58,NULL,'2024-04-29 19:36:38',NULL,NULL,NULL,77,'2024-04-29 19:36:38');



/*Table structure for table `poliza_asegurados` */






CREATE TABLE `poliza_asegurados` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `persona_id` bigint(20) unsigned NOT NULL,
  `poliza_endoso_id` bigint(20) unsigned NOT NULL,
  `rol_asegurado_id` bigint(20) unsigned NOT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_poliza_asegurados_rol_asegurado_idx` (`rol_asegurado_id`),
  KEY `FK_poliza_asegurados_poliza_endosos_idx` (`poliza_endoso_id`),
  KEY `FK_poliza_asegurados_personas_idx` (`persona_id`),
  CONSTRAINT `FK_poliza_asegurados_personas` FOREIGN KEY (`persona_id`) REFERENCES `personas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_poliza_asegurados_poliza_endosos` FOREIGN KEY (`poliza_endoso_id`) REFERENCES `poliza_endosos` (`poliza_id`),
  CONSTRAINT `FK_poliza_asegurados_tipo_endosos` FOREIGN KEY (`rol_asegurado_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;



/*Data for the table `poliza_asegurados` */



/*Table structure for table `poliza_endosos` */






CREATE TABLE `poliza_endosos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `poliza_id` bigint(20) unsigned NOT NULL,
  `tipo_endoso_id` bigint(20) unsigned NOT NULL,
  `numero` varchar(45) DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_polizas_idx` (`poliza_id`),
  KEY `FK_poliza_endosos_tipo_endosos_idx` (`tipo_endoso_id`),
  CONSTRAINT `FK_poliza_endodos_polizas` FOREIGN KEY (`poliza_id`) REFERENCES `polizas` (`id`),
  CONSTRAINT `FK_poliza_endosos_tipo_endosos` FOREIGN KEY (`tipo_endoso_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;



/*Data for the table `poliza_endosos` */



/*Table structure for table `poliza_fechas` */






CREATE TABLE `poliza_fechas` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `poliza_id` bigint(20) unsigned NOT NULL,
  `fecha_vigencia_inicio` date NOT NULL,
  `fecha_vigencia_fin` date DEFAULT NULL,
  `fecha_emision` date DEFAULT NULL,
  `fecha_solicitud` date DEFAULT NULL,
  `fehca_orden` date DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `poliza_fechas_polizas_idx` (`poliza_id`),
  CONSTRAINT `poliza_fechas_polizas` FOREIGN KEY (`poliza_id`) REFERENCES `polizas` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;



/*Data for the table `poliza_fechas` */



/*Table structure for table `poliza_intermediarios` */






CREATE TABLE `poliza_intermediarios` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `persona_id` bigint(20) unsigned NOT NULL,
  `poliza_endoso_id` bigint(20) unsigned NOT NULL,
  `rol_intermediario_id` bigint(20) unsigned NOT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_poliza_intermediarios_rol_intermediario_idx` (`rol_intermediario_id`),
  KEY `FK_poliza_intermediarios_poliza_endosos_idx` (`poliza_endoso_id`),
  KEY `FK_poliza_intermediarios_personas_idx` (`persona_id`),
  CONSTRAINT `FK_poliza_intermediarios_personas` FOREIGN KEY (`persona_id`) REFERENCES `personas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_poliza_intermediarios_poliza_endosos` FOREIGN KEY (`poliza_endoso_id`) REFERENCES `poliza_endosos` (`poliza_id`),
  CONSTRAINT `FK_poliza_intermediarios_tipo_endosos` FOREIGN KEY (`rol_intermediario_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;



/*Data for the table `poliza_intermediarios` */



/*Table structure for table `polizas` */






CREATE TABLE `polizas` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `aseguradora_id` bigint(20) unsigned NOT NULL,
  `tipo_riesgo_id` bigint(20) unsigned NOT NULL,
  `estado_id` bigint(20) unsigned NOT NULL,
  `tipo_vigencia_id` bigint(20) unsigned NOT NULL,
  `tipo_refacturacion_id` bigint(20) unsigned NOT NULL,
  `numero` varchar(45) DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `updated_by` bigint(20) unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `polizas_estado_id_idx` (`estado_id`),
  KEY `polizas_tipo_vigencia_id_idx` (`tipo_vigencia_id`),
  KEY `polizas_tipo_refacturacion_id_idx` (`tipo_refacturacion_id`),
  KEY `polizas_tipo_riesgo_id_idx` (`tipo_riesgo_id`),
  KEY `polizas_aseguradora_id_idx` (`aseguradora_id`),
  CONSTRAINT `polizas_aseguradora_id` FOREIGN KEY (`aseguradora_id`) REFERENCES `aseguradoras` (`id`),
  CONSTRAINT `polizas_estado_id` FOREIGN KEY (`estado_id`) REFERENCES `entidades` (`id`),
  CONSTRAINT `polizas_tipo_refacturacion_id` FOREIGN KEY (`tipo_refacturacion_id`) REFERENCES `entidades` (`id`),
  CONSTRAINT `polizas_tipo_riesgo_id` FOREIGN KEY (`tipo_riesgo_id`) REFERENCES `entidades` (`id`),
  CONSTRAINT `polizas_tipo_vigencia_id` FOREIGN KEY (`tipo_vigencia_id`) REFERENCES `entidades` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;



/*Data for the table `polizas` */



/*Table structure for table `role_has_permissions` */






CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `role_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`role_id`),
  KEY `role_has_permissions_role_id_foreign` (`role_id`),
  CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



/*Data for the table `role_has_permissions` */



insert  into `role_has_permissions`(`permission_id`,`role_id`) values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1);



/*Table structure for table `roles` */






CREATE TABLE `roles` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `guard_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



/*Data for the table `roles` */



insert  into `roles`(`id`,`name`,`guard_name`,`created_at`,`updated_at`) values (1,'Superadmin','web','2024-03-27 19:56:15','2024-03-27 19:56:15'),(2,'Usuario','web','2024-03-27 19:56:15','2024-03-27 19:56:15');



/*Table structure for table `sessions` */






CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_activity` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



/*Data for the table `sessions` */



insert  into `sessions`(`id`,`user_id`,`ip_address`,`user_agent`,`payload`,`last_activity`) values ('NyaLCc2CW6d3qsJrEIrp4hRVXhvJJRrNVYxa7XIe',1,'127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36','YTo2OntzOjY6Il90b2tlbiI7czo0MDoieFhuOHZTZGxMaGN4QUVEQ3hvdmcyUWhqVzExZ1RNbWhrekdWOGdvaiI7czozOiJ1cmwiO2E6MDp7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjMwOiJodHRwOi8vZGV2Lmdsb2JhbHNlZy5jb20vbG9naW4iO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX1zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aToxO3M6MTc6InBhc3N3b3JkX2hhc2hfd2ViIjtzOjYwOiIkMnkkMTAkdXk2aUJJbWlNQm8wQ05yS1duZ29udWlVMldSQzFFaUtnM0l3Y3U0cDRJNURmalRZOVZDVE8iO30=',1714491080);



/*Table structure for table `tipo_entidades` */






CREATE TABLE `tipo_entidades` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(100) NOT NULL,
  `padre_id` int(10) unsigned DEFAULT NULL,
  `codigo` varchar(50) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `tipo_entidades_codigo_unique` (`codigo`),
  KEY `tipo_entidades_padre_id_index` (`padre_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4;



/*Data for the table `tipo_entidades` */



insert  into `tipo_entidades`(`id`,`nombre`,`padre_id`,`codigo`,`created_at`,`updated_at`,`deleted_at`) values (1,'Genero',NULL,'genero','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(2,'Nacionalidad',NULL,'nacionalidad','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(3,'Estado Civil',NULL,'estado_civil','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(4,'Tipo Documento',NULL,'tipo_documento','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(5,'Tipo Teléfono',NULL,'tipo_telefono','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(6,'Tipo Domicilio',NULL,'tipo_domicilio','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(7,'Tipo Email',NULL,'tipo_email','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(8,'Provincia',NULL,'provincia','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(9,'Condición IVA',NULL,'condicion_iva','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(10,'Ingresos Brutos',NULL,'ingresos_brutos','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(11,'Mes',NULL,'mes','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL),(12,'Tipo Persona',NULL,'tipo_persona','2024-04-05 22:21:11','2024-04-05 22:21:11',NULL);







