CREATE DATABASE  IF NOT EXISTS `medical_center_db`;
USE `medical_center_db`;
-- MySQL dump 10.13  Distrib 8.0.29, for Win64 (x86_64)
--
-- Host: 127.0.0.1    Database: medical_cemter_db
-- ------------------------------------------------------
-- Server version	8.0.29


SET FOREIGN_KEY_CHECKS=0;
--
-- Table structure for table `especiality`
--
DROP TABLE IF EXISTS `especiality`;
CREATE TABLE `especiality` (
  `id` varchar(5) NOT NULL,
  `name` varchar(45) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `especiality`
--
LOCK TABLES `especiality` WRITE;
UNLOCK TABLES;


--
-- Table structure for table `failed_jobs`
--

DROP TABLE IF EXISTS `failed_jobs`;
CREATE TABLE `failed_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `failed_jobs`
--

LOCK TABLES `failed_jobs` WRITE;
UNLOCK TABLES;


--
-- Table structure for table `migrations`
--

DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

LOCK TABLES `migrations` WRITE;
INSERT INTO `migrations` VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2014_10_12_100000_create_password_resets_table',1),(3,'2019_08_19_000000_create_failed_jobs_table',1),(4,'2023_03_12_014553_laratrust_setup_tables',1);
UNLOCK TABLES;


--
-- Table structure for table `password_resets`
--

DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE `password_resets` (
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

LOCK TABLES `password_resets` WRITE;
UNLOCK TABLES;


--
-- Table structure for table `patients`
--
DROP TABLE IF EXISTS `patients`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `patients` (
  `id` varchar(255) NOT NULL,
  `identification` varchar(255) DEFAULT NULL,
  `firstname` varchar(45) NOT NULL,
  `lastname` varchar(45) NOT NULL,
  `age` varchar(45) NOT NULL,
  `gender` enum('F','M','O') NOT NULL,
  `email` varchar(45) DEFAULT NULL,
  `phone` varchar(45) DEFAULT NULL,
  `birthday` datetime NOT NULL,
  `blood_type` enum('A+','A-','B+','B-','O+','O-','AB+','AB-') DEFAULT NULL,
  `address` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

LOCK TABLES `patients` WRITE;
UNLOCK TABLES;

--
-- Table structure for table `permission_role`
--

DROP TABLE IF EXISTS `permission_role`;
CREATE TABLE `permission_role` (
  `permission_id` bigint unsigned NOT NULL,
  `role_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`role_id`),
  KEY `permission_role_role_id_foreign` (`role_id`),
  CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


LOCK TABLES `permission_role` WRITE;
INSERT INTO `permission_role` 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),(24,1),(25,1),(26,1),(1,2),(2,2),(3,2),(4,2),(8,2),(9,2),(12,2),(13,2),(16,2),(21,2),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(1,4),(2,4),(3,4),(4,4),(5,4),(6,4),(7,4),(8,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4);
UNLOCK TABLES;


--
-- Table structure for table `permission_user`
--
DROP TABLE IF EXISTS `permission_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `permission_user` (
  `permission_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  `user_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`user_id`,`permission_id`,`user_type`),
  KEY `permission_user_permission_id_foreign` (`permission_id`),
  CONSTRAINT `permission_user_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

LOCK TABLES `permission_user` WRITE;
UNLOCK TABLES;

--
-- Table structure for table `permissions`
--
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `display_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_unique` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


LOCK TABLES `permissions` WRITE;
INSERT INTO `permissions` VALUES (1,'create-appointment','Create Appointment','Create Appointment','2023-03-12 11:19:25','2023-03-12 11:19:25'),(2,'update-appointment','Update Appointment','Update Appointment','2023-03-12 11:19:25','2023-03-12 11:19:25'),(3,'delete-appointment','Delete Appointment','Delete Appointment','2023-03-12 11:19:25','2023-03-12 11:19:25'),(4,'view-appointment','View Appointment','View Appointment','2023-03-12 11:19:25','2023-03-12 11:19:25'),(5,'create-history','Create History','Create History','2023-03-12 11:19:25','2023-03-12 11:19:25'),(6,'update-history','Update History','Update History','2023-03-12 11:19:26','2023-03-12 11:19:26'),(7,'delete-history','Delete History','Delete History','2023-03-12 11:19:26','2023-03-12 11:19:26'),(8,'view-history','View History','View History','2023-03-12 11:19:26','2023-03-12 11:19:26'),(9,'create-patient','Create Patient','Create Patient','2023-03-12 11:19:26','2023-03-12 11:19:26'),(10,'update-patient','Update Patient','Update Patient','2023-03-12 11:19:26','2023-03-12 11:19:26'),(11,'delete-patient','Delete Patient','Delete Patient','2023-03-12 11:19:26','2023-03-12 11:19:26'),(12,'view-patient','View Patient','View Patient','2023-03-12 11:19:27','2023-03-12 11:19:27'),(13,'create-representative','Create Representative','Create Representative','2023-03-12 11:19:27','2023-03-12 11:19:27'),(14,'update-representative','Update Representative','Update Representative','2023-03-12 11:19:27','2023-03-12 11:19:27'),(15,'delete-representative','Delete Representative','Delete Representative','2023-03-12 11:19:27','2023-03-12 11:19:27'),(16,'view-representative','View Representative','View Representative','2023-03-12 11:19:27','2023-03-12 11:19:27'),(17,'create-user','Create User','Create User','2023-03-12 11:19:27','2023-03-12 11:19:27'),(18,'update-user','Update User','Update User','2023-03-12 11:19:28','2023-03-12 11:19:28'),(19,'delete-user','Delete User','Delete User','2023-03-12 11:19:28','2023-03-12 11:19:28'),(20,'view-user','View User','View User','2023-03-12 11:19:28','2023-03-12 11:19:28'),(21,'view-area','View Area','View Area','2023-03-12 11:19:28','2023-03-12 11:19:28'),(22,'create-area','Create Area','Create Area','2023-03-12 11:19:28','2023-03-12 11:19:28'),(23,'update-area','Update Area','Update Area','2023-03-12 11:19:28','2023-03-12 11:19:28'),(24,'create-control-history','Create Control History','Create Control History','2023-03-12 11:19:28','2023-03-12 11:19:28'),(25,'update-control-history','Update Control History','Update Control History','2023-03-12 11:19:28','2023-03-12 11:19:28'),(26,'download-history','Download History','Download History','2023-03-12 11:19:28','2023-03-12 11:19:28');
UNLOCK TABLES;

--
-- Table structure for table `roles`
--
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `display_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_unique` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


LOCK TABLES `roles` WRITE;
INSERT INTO `roles` VALUES (1,'doctor','Doctor','Doctor','2023-03-12 11:19:24','2023-03-12 11:19:24'),(2,'receptionist','Receptionist','Receptionist','2023-03-12 11:19:24','2023-03-12 11:19:24'),(3,'admin','User Administrator','User is allowed to manage and edit other users','2023-03-12 11:19:24','2023-03-12 11:19:24'),(4,'root','root','User root','2023-03-12 11:19:24','2023-03-12 11:19:24');
UNLOCK TABLES;

--
-- Table structure for table `history`
--

DROP TABLE IF EXISTS `history`;
CREATE TABLE `history` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `patients_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `users_id` bigint unsigned NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `summary` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `especiality` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_history_especiality1` (`especiality`),
  KEY `fk_history_patients1` (`patients_id`),
  KEY `fk_history_users1_idx` (`users_id`),
  CONSTRAINT `fk_history_especiality1` FOREIGN KEY (`especiality`) REFERENCES `especiality` (`id`),
  CONSTRAINT `fk_history_patients1` FOREIGN KEY (`patients_id`) REFERENCES `patients` (`id`),
  CONSTRAINT `fk_history_users1` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `history`
--

LOCK TABLES `history` WRITE;
UNLOCK TABLES;

--
-- Table structure for table `physical_exam`
--

DROP TABLE IF EXISTS `physical_exam`;
CREATE TABLE `physical_exam` (
  `id` varchar(255) NOT NULL,
  `history_id` varchar(255) NOT NULL,
  `value` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_physical_exam_history1_idx` (`history_id`),
  CONSTRAINT `fk_physical_exam_history1` FOREIGN KEY (`history_id`) REFERENCES `history` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

LOCK TABLES `physical_exam` WRITE;
UNLOCK TABLES;

--
-- Table structure for table `relationship`
--

DROP TABLE IF EXISTS `relationship`;
CREATE TABLE `relationship` (
  `representative_id` varchar(255) NOT NULL,
  `patients_id` varchar(255) NOT NULL,
  `title` varchar(45) NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`representative_id`,`patients_id`),
  KEY `fk_representative_has_patients_patients1_idx` (`patients_id`),
  KEY `fk_representative_has_patients_representative1_idx` (`representative_id`),
  CONSTRAINT `fk_representative_has_patients_patients1` FOREIGN KEY (`patients_id`) REFERENCES `patients` (`id`),
  CONSTRAINT `fk_representative_has_patients_representative1` FOREIGN KEY (`representative_id`) REFERENCES `representative` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

LOCK TABLES `relationship` WRITE;
UNLOCK TABLES;


--
-- Table structure for table `representative`
--

DROP TABLE IF EXISTS `representative`;
CREATE TABLE `representative` (
  `id` varchar(255) NOT NULL,
  `identification` varchar(255) NOT NULL,
  `firstname` varchar(45) NOT NULL,
  `lastname` varchar(45) NOT NULL,
  `age` varchar(45) NOT NULL,
  `gender` enum('F','M','O') NOT NULL,
  `email` varchar(45) DEFAULT NULL,
  `phone` varchar(45) NOT NULL,
  `address` text NOT NULL,
  `birthday` datetime DEFAULT NULL,
  `blood_type` enum('A+','A-','B+','B-','O+','O-','AB+','AB-') DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `identification_UNIQUE` (`identification`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

LOCK TABLES `representative` WRITE;
UNLOCK TABLES;


--
-- Table structure for table `role_user`
--

DROP TABLE IF EXISTS `role_user`;
CREATE TABLE `role_user` (
  `role_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  `user_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`user_id`,`role_id`,`user_type`),
  KEY `role_user_role_id_foreign` (`role_id`),
  CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

LOCK TABLES `role_user` WRITE;
INSERT INTO `role_user` VALUES (4,14,'App\\Models\\User','2023-04-01 07:59:56','2023-04-01 07:59:56');
UNLOCK TABLES;

--
-- Table structure for table `section_history`
--

DROP TABLE IF EXISTS `section_history`;
CREATE TABLE `section_history` (
  `id` varchar(255) NOT NULL,
  `history_id` varchar(255) NOT NULL,
  `section_type_id` varchar(255) NOT NULL,
  `title` varchar(45) DEFAULT NULL,
  `summary` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_section_history_history1_idx` (`history_id`),
  KEY `fk_section_history_section_type1_idx` (`section_type_id`),
  CONSTRAINT `fk_section_history_history1` FOREIGN KEY (`history_id`) REFERENCES `history` (`id`),
  CONSTRAINT `fk_section_history_section_type1` FOREIGN KEY (`section_type_id`) REFERENCES `section_type` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


LOCK TABLES `section_history` WRITE;
UNLOCK TABLES;

--
-- Table structure for table `section_type`
--

DROP TABLE IF EXISTS `section_type`;
CREATE TABLE `section_type` (
  `id` varchar(255) NOT NULL,
  `section_type_id` varchar(255) DEFAULT NULL,
  `key` varchar(45) NOT NULL,
  `value` varchar(45) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `position` varchar(45) DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_section_type_section_type1_idx` (`section_type_id`),
  CONSTRAINT `fk_section_type_section_type1` FOREIGN KEY (`section_type_id`) REFERENCES `section_type` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

LOCK TABLES `section_type` WRITE;
INSERT INTO `section_type` VALUES ('011ecee7d295c066ae68d4396215c3d0','28c8edde3d61a0411511d3b1866f0636','BDEV','Developer_Background','2022-09-05 23:20:26','4',NULL),('28c8edde3d61a0411511d3b1866f0636',NULL,'BACK','Background','2022-09-05 23:16:07','0',NULL),('38026ed22fc1a91d92b5d2ef93540f20','28c8edde3d61a0411511d3b1866f0636','BPTA','Perinatal_Background','2022-09-05 23:18:28','2',NULL),('3d2f8900f2e49c02b481c2f717aa9020','28c8edde3d61a0411511d3b1866f0636','BINM','Immunizations_Background','2022-09-05 23:25:51','6',NULL),('4c0d13d3ad6cc317017872e51d01b238','28c8edde3d61a0411511d3b1866f0636','SALM','Alimentation','2022-09-05 23:30:32','3',NULL),('4e44f1ac85cd60e3caa56bfd4afb675e','28c8edde3d61a0411511d3b1866f0636','BPSI','Psychobiology_Background','2022-09-05 23:23:03','5',NULL),('665f644e43731ff9db3d341da5c827e1','28c8edde3d61a0411511d3b1866f0636','BPER','Personal_Background','2022-09-05 23:17:13','7',NULL),('7bfc85c0d74ff05806e0b5a0fa0c1df1','28c8edde3d61a0411511d3b1866f0636','BOTA','Obstetric_Background','2022-09-11 01:42:05','1',NULL),('815e6212def15fe76ed27cec7a393d59','28c8edde3d61a0411511d3b1866f0636','BFAM','Family_Background','2022-09-05 23:29:31','8',NULL),('8d8e353b98d5191d5ceea1aa3eb05d43',NULL,'ANTR','Nutritional_Score','2022-09-05 23:31:28','9',NULL);
UNLOCK TABLES;


--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

LOCK TABLES `users` WRITE;
INSERT INTO `users` VALUES (14,'root','root@root.com',NULL,'$2y$10$SlZ8FkedupD7jFmmqKj7COcM3NHkj.arcOYDCGxQEzwz5LtgJfoYa',NULL,'2023-04-01 07:59:56','2023-04-01 07:59:56');
UNLOCK TABLES;
--
-- Table structure for table `appointments`
--

DROP TABLE IF EXISTS `appointments`;
CREATE TABLE `appointments` (
  `id` varchar(255) NOT NULL,
  `patients_id` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `date` timestamp NOT NULL,
  `especiality` varchar(5) NOT NULL,
  `active` bigint DEFAULT '1',
  `summary` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code_UNIQUE` (`code`),
  KEY `fk_appointments_patients_idx` (`patients_id`),
  KEY `fk_history_especiality1_idx` (`especiality`),
  CONSTRAINT `fk_appointments_patients` FOREIGN KEY (`patients_id`) REFERENCES `patients` (`id`),
  CONSTRAINT `fk_history_especiality2` FOREIGN KEY (`especiality`) REFERENCES `especiality` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `appointments`
--

LOCK TABLES `appointments` WRITE;
UNLOCK TABLES;

--
-- Table structure for table `control_history`
--

DROP TABLE IF EXISTS `control_history`;
CREATE TABLE `control_history` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `history_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `users_id` bigint unsigned NOT NULL,
  `especiality` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `summary` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_control_history_especiality1` (`especiality`),
  KEY `fk_control_history_history1` (`history_id`),
  KEY `fk_control_history_users1_idx` (`users_id`),
  CONSTRAINT `fk_control_history_especiality1` FOREIGN KEY (`especiality`) REFERENCES `especiality` (`id`),
  CONSTRAINT `fk_control_history_history1` FOREIGN KEY (`history_id`) REFERENCES `history` (`id`),
  CONSTRAINT `fk_control_history_users1` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

LOCK TABLES `control_history` WRITE;
UNLOCK TABLES;

--
-- Table structure for table `control_physical_exam`
--

DROP TABLE IF EXISTS `control_physical_exam`;
CREATE TABLE `control_physical_exam` (
  `id` varchar(255) NOT NULL,
  `control_history_id` varchar(255) NOT NULL,
  `value` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_control_physical_exam_control_history1_idx` (`control_history_id`),
  CONSTRAINT `fk_control_physical_exam_control_history1` FOREIGN KEY (`control_history_id`) REFERENCES `control_history` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


LOCK TABLES `control_physical_exam` WRITE;
UNLOCK TABLES;

--
-- Table structure for table `control_section_history`
--

DROP TABLE IF EXISTS `control_section_history`;
CREATE TABLE `control_section_history` (
  `id` varchar(255) NOT NULL,
  `control_history_id` varchar(255) NOT NULL,
  `section_type_id` varchar(255) NOT NULL,
  `title` varchar(45) DEFAULT NULL,
  `summary` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_control_section_history_control_history1_idx` (`control_history_id`),
  KEY `fk_control_section_history_section_type1_idx` (`section_type_id`),
  CONSTRAINT `fk_control_section_history_control_history1` FOREIGN KEY (`control_history_id`) REFERENCES `control_history` (`id`),
  CONSTRAINT `fk_control_section_history_section_type1` FOREIGN KEY (`section_type_id`) REFERENCES `section_type` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `control_section_history`
--

LOCK TABLES `control_section_history` WRITE;
UNLOCK TABLES;


--
-- Dumping data for table `settings`
--
DROP TABLE IF EXISTS `settings`;
CREATE TABLE `settings` (
  `id` varchar(255) NOT NULL,
  `key` varchar(45) NOT NULL,
  `value` longtext NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `title_UNIQUE` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

LOCK TABLES `settings` WRITE;
UNLOCK TABLES;

-- Dump completed on 2023-03-31 19:30:14

SET FOREIGN_KEY_CHECKS = 1;
