From a41eede52f6dbcc9691a11cad3d340d2c494fd9e Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 10 May 2024 11:34:25 -0400 Subject: [PATCH] DB update for the upcoming user client restricted access permissions --- database_updates.php | 13 ++++++++++--- database_version.php | 2 +- db.sql | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/database_updates.php b/database_updates.php index a4685591..f9fbdbdc 100644 --- a/database_updates.php +++ b/database_updates.php @@ -1886,10 +1886,17 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.9'"); } - // if (CURRENT_DATABASE_VERSION == '1.2.9') { - // // Insert queries here required to update to DB version 1.2.10 + if (CURRENT_DATABASE_VERSION == '1.2.9') { + + mysqli_query($mysqli, "CREATE TABLE `user_permissions` (`user_id` int(11) NOT NULL,`client_id` int(11) NOT NULL, PRIMARY KEY (`user_id`,`client_id`))"); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.0'"); + } + + // if (CURRENT_DATABASE_VERSION == '1.3.0') { + // // Insert queries here required to update to DB version 1.3.0 // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.10"); + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.1"); // } } else { diff --git a/database_version.php b/database_version.php index aa46a4ac..91fe0b03 100644 --- a/database_version.php +++ b/database_version.php @@ -5,4 +5,4 @@ * It is used in conjunction with database_updates.php */ -DEFINE("LATEST_DATABASE_VERSION", "1.2.9"); +DEFINE("LATEST_DATABASE_VERSION", "1.3.0"); diff --git a/db.sql b/db.sql index 2e016f17..0bd7cf94 100644 --- a/db.sql +++ b/db.sql @@ -1375,7 +1375,7 @@ CREATE TABLE `settings` ( `config_telemetry` tinyint(1) DEFAULT 0, `config_timezone` varchar(200) NOT NULL DEFAULT 'America/New_York', `config_destructive_deletes_enable` tinyint(1) NOT NULL DEFAULT 0, - `config_phone_number` tinyint(1) NOT NULL DEFAULT 1, + `config_phone_mask` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`company_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1777,6 +1777,20 @@ CREATE TABLE `trips` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `user_permissions` +-- + +DROP TABLE IF EXISTS `user_permissions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_permissions` ( + `user_id` int(11) NOT NULL, + `client_id` int(11) NOT NULL, + PRIMARY KEY (`user_id`,`client_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `user_settings` -- @@ -1903,4 +1917,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-04-12 19:37:23 +-- Dump completed on 2024-05-10 11:33:39