From 3401bcb0012aa6d031074809aa8f5edf2099ce4e Mon Sep 17 00:00:00 2001 From: James Ging Date: Thu, 5 Sep 2024 12:53:52 -0700 Subject: [PATCH] Added user_manager table for tracking management relationships --- db/dummy_data.sql | 8 ++++++++ db/schema.v0.sql | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/db/dummy_data.sql b/db/dummy_data.sql index b3d0b88a..60e75117 100644 --- a/db/dummy_data.sql +++ b/db/dummy_data.sql @@ -122,6 +122,14 @@ INSERT INTO `user_contact` VALUES UNLOCK TABLES; +LOCK TABLES `user_manager` WRITE; +/*!40000 ALTER TABLE `user_manager` DISABLE KEYS */; +INSERT INTO `user_manager` VALUES + (3, 2), + (2, 1); +/*!40000 ALTER TABLE `user_manager` ENABLE KEYS */; +UNLOCK TABLES; + LOCK TABLES `event` WRITE; /*!40000 ALTER TABLE `event` DISABLE KEYS */; INSERT INTO `event` (`id`, `team_id`, `role_id`, `schedule_id`, `user_id`, `start`, `end`) VALUES diff --git a/db/schema.v0.sql b/db/schema.v0.sql index 6385598b..411681f9 100644 --- a/db/schema.v0.sql +++ b/db/schema.v0.sql @@ -332,6 +332,19 @@ CREATE TABLE IF NOT EXISTS `user_contact` ( ON DELETE CASCADE ); +-- ----------------------------------------------------- +-- Table `user_manager` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `user_manager` ( + `report_id` BIGINT(20) UNSIGNED NOT NULL, + `manager_id` BIGINT(20) UNSIGNED NOT NULL, + PRIMARY KEY (`report_id`), + CONSTRAINT `user_manager_report_id_fk` FOREIGN KEY (`report_id`) REFERENCES `user` (`id`) + ON DELETE CASCADE, + CONSTRAINT `user_manager_manager_id_fk` FOREIGN KEY (`manager_id`) REFERENCES `user` (`id`) + ON DELETE CASCADE +); + -- ----------------------------------------------------- -- Table `audit` -- -----------------------------------------------------