diff --git a/database_updates.php b/database_updates.php index e844d20b..4805b338 100644 --- a/database_updates.php +++ b/database_updates.php @@ -1097,11 +1097,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.8'"); } - //if (CURRENT_DATABASE_VERSION == '0.5.8') { - //Insert queries here required to update to DB version 0.5.9 + if (CURRENT_DATABASE_VERSION == '0.5.8') { + mysqli_query($mysqli, "ALTER TABLE `contacts` ADD `contact_primary` TINYINT(1) NOT NULL DEFAULT 0 AFTER `contact_token_expire`"); + mysqli_query($mysqli, "ALTER TABLE `locations` ADD `location_primary` TINYINT(1) NOT NULL DEFAULT 0 AFTER `location_photo`"); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.9'"); + } + + //if (CURRENT_DATABASE_VERSION == '0.5.9') { + //Insert queries here required to update to DB version 0.6.0 // Then, update the database to the next sequential version - //mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.9'"); + //mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.0'"); //} } else { diff --git a/database_version.php b/database_version.php index 14eeb315..5b4a09ed 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", "0.5.8"); +DEFINE("LATEST_DATABASE_VERSION", "0.5.9"); diff --git a/db.sql b/db.sql index 9b4126c7..bbe07477 100644 --- a/db.sql +++ b/db.sql @@ -357,6 +357,7 @@ CREATE TABLE `contacts` ( `contact_password_hash` varchar(200) DEFAULT NULL, `contact_password_reset_token` varchar(200) DEFAULT NULL, `contact_token_expire` datetime DEFAULT NULL, + `contact_primary` tinyint(1) NOT NULL DEFAULT 0, `contact_important` tinyint(1) NOT NULL DEFAULT 0, `contact_billing` tinyint(1) DEFAULT 0, `contact_technical` tinyint(1) DEFAULT 0, @@ -682,6 +683,7 @@ CREATE TABLE `locations` ( `location_phone` varchar(200) DEFAULT NULL, `location_hours` varchar(200) DEFAULT NULL, `location_photo` varchar(200) DEFAULT NULL, + `location_primary` tinyint(1) NOT NULL DEFAULT 0, `location_notes` text DEFAULT NULL, `location_created_at` datetime NOT NULL DEFAULT current_timestamp(), `location_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -1616,4 +1618,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-20 19:53:31 +-- Dump completed on 2023-07-03 16:38:34