DB Structure Update: Add Fax to location, Delete Vendor Contacts tables decided to merge vendor contacts and conacts as one table as contacts table already had a reference to vendor_id

This commit is contained in:
johnnyq 2024-12-13 15:12:48 -05:00
parent 10496c2971
commit a21cb08914
3 changed files with 14 additions and 30 deletions

View File

@ -2368,10 +2368,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.2'");
}
// if (CURRENT_DATABASE_VERSION == '1.7.2') {
// // Insert queries here required to update to DB version 1.7.3
if (CURRENT_DATABASE_VERSION == '1.7.2') {
mysqli_query($mysqli, "ALTER TABLE `locations` ADD `location_fax` VARCHAR(200) DEFAULT NULL AFTER `location_phone`");
mysqli_query($mysqli, "DROP TABLE `vendor_contacts`");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.3'");
}
// if (CURRENT_DATABASE_VERSION == '1.7.3') {
// // Insert queries here required to update to DB version 1.7.4
// // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.3'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.4'");
// }
} else {

View File

@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php
*/
DEFINE("LATEST_DATABASE_VERSION", "1.7.2");
DEFINE("LATEST_DATABASE_VERSION", "1.7.3");

28
db.sql
View File

@ -920,6 +920,7 @@ CREATE TABLE `locations` (
`location_state` varchar(200) DEFAULT NULL,
`location_zip` varchar(200) DEFAULT NULL,
`location_phone` varchar(200) DEFAULT NULL,
`location_fax` varchar(200) DEFAULT NULL,
`location_hours` varchar(200) DEFAULT NULL,
`location_photo` varchar(200) DEFAULT NULL,
`location_primary` tinyint(1) NOT NULL DEFAULT 0,
@ -2182,31 +2183,6 @@ CREATE TABLE `users` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `vendor_contacts`
--
DROP TABLE IF EXISTS `vendor_contacts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vendor_contacts` (
`vendor_contact_id` int(11) NOT NULL AUTO_INCREMENT,
`vendor_contact_name` varchar(200) NOT NULL,
`vendor_contact_title` varchar(200) DEFAULT NULL,
`vendor_contact_department` varchar(200) DEFAULT NULL,
`vendor_contact_email` varchar(200) DEFAULT NULL,
`vendor_contact_phone` varchar(200) DEFAULT NULL,
`vendor_contact_extension` varchar(200) DEFAULT NULL,
`vendor_contact_mobile` varchar(200) DEFAULT NULL,
`vendor_contact_notes` text DEFAULT NULL,
`vendor_contact_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`vendor_contact_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`vendor_contact_archived_at` datetime DEFAULT NULL,
`vendor_contact_vendor_id` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`vendor_contact_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `vendor_documents`
--
@ -2290,4 +2266,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-12-10 22:05:33
-- Dump completed on 2024-12-13 15:11:31