diff --git a/database_updates.php b/database_updates.php index c9485e49..bceb122e 100644 --- a/database_updates.php +++ b/database_updates.php @@ -2232,16 +2232,57 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.6.5'"); } - if (CURRENT_DATABASE_VERSION == '1.6.5') { - mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_quote_notification_email` VARCHAR(200) DEFAULT NULL AFTER `config_quote_from_email`"); + if (CURRENT_DATABASE_VERSION == '1.6.5') { + mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_quote_notification_email` VARCHAR(200) DEFAULT NULL AFTER `config_quote_from_email`"); - mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.6.6'"); - } + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.6.6'"); + } - // if (CURRENT_DATABASE_VERSION == '1.6.6') { - // // Insert queries here required to update to DB version 1.6.7 + if (CURRENT_DATABASE_VERSION == '1.6.6') { + + mysqli_query($mysqli, "CREATE TABLE `contact_notes` ( + `contact_note_id` INT(11) NOT NULL AUTO_INCREMENT, + `contact_note_type` VARCHAR(200) NOT NULL, + `contact_note` TEXT NULL DEFAULT NULL, + `contact_note_created_by` INT(11) NOT NULL, + `contact_note_created_at` DATETIME NOT NULL DEFAULT current_timestamp(), + `contact_note_updated_at` DATETIME NULL DEFAULT NULL on update CURRENT_TIMESTAMP, + `contact_note_archived_at` DATETIME NULL DEFAULT NULL, + `contact_note_contact_id` INT(11) NOT NULL, + PRIMARY KEY (`contact_note_id`) + )"); + + mysqli_query($mysqli, "CREATE TABLE `client_notes` ( + `client_note_id` INT(11) NOT NULL AUTO_INCREMENT, + `client_note_type` VARCHAR(200) NOT NULL, + `client_note` TEXT NULL DEFAULT NULL, + `client_note_created_by` INT(11) NOT NULL, + `client_note_created_at` DATETIME NOT NULL DEFAULT current_timestamp(), + `client_note_updated_at` DATETIME NULL DEFAULT NULL on update CURRENT_TIMESTAMP, + `client_note_archived_at` DATETIME NULL DEFAULT NULL, + `client_note_client_id` INT(11) NOT NULL, + PRIMARY KEY (`client_note_id`) + )"); + + mysqli_query($mysqli, "CREATE TABLE `asset_notes` ( + `asset_note_id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_note_type` VARCHAR(200) NOT NULL, + `asset_note` TEXT NULL DEFAULT NULL, + `asset_note_created_by` INT(11) NOT NULL, + `asset_note_created_at` DATETIME NOT NULL DEFAULT current_timestamp(), + `asset_note_updated_at` DATETIME NULL DEFAULT NULL on update CURRENT_TIMESTAMP, + `asset_note_archived_at` DATETIME NULL DEFAULT NULL, + `asset_note_asset_id` INT(11) NOT NULL, + PRIMARY KEY (`asset_note_id`) + )"); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.6.7'"); + } + + // if (CURRENT_DATABASE_VERSION == '1.6.7') { + // // Insert queries here required to update to DB version 1.6.8 // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.6.7'"); + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.6.8'"); // } } else { diff --git a/database_version.php b/database_version.php index d8b464c4..30e5d0c9 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.6.6"); +DEFINE("LATEST_DATABASE_VERSION", "1.6.7"); diff --git a/db.sql b/db.sql index b6706f94..2edc929d 100644 --- a/db.sql +++ b/db.sql @@ -143,6 +143,26 @@ CREATE TABLE `asset_interfaces` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `asset_notes` +-- + +DROP TABLE IF EXISTS `asset_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `asset_notes` ( + `asset_note_id` int(11) NOT NULL AUTO_INCREMENT, + `asset_note_type` varchar(200) NOT NULL, + `asset_note` text DEFAULT NULL, + `asset_note_created_by` int(11) NOT NULL, + `asset_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), + `asset_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), + `asset_note_archived_at` datetime DEFAULT NULL, + `asset_note_asset_id` int(11) NOT NULL, + PRIMARY KEY (`asset_note_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `assets` -- @@ -266,6 +286,26 @@ CREATE TABLE `certificates` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `client_notes` +-- + +DROP TABLE IF EXISTS `client_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `client_notes` ( + `client_note_id` int(11) NOT NULL AUTO_INCREMENT, + `client_note_type` varchar(200) NOT NULL, + `client_note` text DEFAULT NULL, + `client_note_created_by` int(11) NOT NULL, + `client_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), + `client_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), + `client_note_archived_at` datetime DEFAULT NULL, + `client_note_client_id` int(11) NOT NULL, + PRIMARY KEY (`client_note_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `client_tags` -- @@ -391,6 +431,26 @@ CREATE TABLE `contact_logins` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `contact_notes` +-- + +DROP TABLE IF EXISTS `contact_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contact_notes` ( + `contact_note_id` int(11) NOT NULL AUTO_INCREMENT, + `contact_note_type` varchar(200) NOT NULL, + `contact_note` text DEFAULT NULL, + `contact_note_created_by` int(11) NOT NULL, + `contact_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), + `contact_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), + `contact_note_archived_at` datetime DEFAULT NULL, + `contact_note_contact_id` int(11) NOT NULL, + PRIMARY KEY (`contact_note_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `contact_tags` -- @@ -2167,4 +2227,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-11-04 12:20:25 +-- Dump completed on 2024-11-23 15:34:58