diff --git a/database_updates.php b/database_updates.php index bfae7fe8..3395f2c5 100644 --- a/database_updates.php +++ b/database_updates.php @@ -1461,17 +1461,6 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.0'"); } - if (CURRENT_DATABASE_VERSION == '0.9.1') { - // Insert queries here required to update to DB version 0.9.2 - mysqli_query($mysqli, "ALTER TABLE `invoices` ADD `invoice_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `invoice_due`"); - mysqli_query($mysqli, "ALTER TABLE `recurring` ADD `recurring_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `recurring_status`"); - mysqli_query($mysqli, "ALTER TABLE `quotes` ADD `quote_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `quote_status`"); - - // Then update the database to the next sequential version - mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.2'"); - - } - // Be sure to change database_version.php to reflect the version you are updating to here // Please add this same comment block to the bottom of this file, and update the version number. // Uncomment Below Lines, to add additional database updates @@ -1484,6 +1473,24 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.1'"); } + if (CURRENT_DATABASE_VERSION == '0.9.1') { + // Insert queries here required to update to DB version 0.9.2 + mysqli_query($mysqli, "ALTER TABLE `invoices` ADD `invoice_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `invoice_due`"); + mysqli_query($mysqli, "ALTER TABLE `recurring` ADD `recurring_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `recurring_status`"); + mysqli_query($mysqli, "ALTER TABLE `quotes` ADD `quote_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `quote_status`"); + + // Then update the database to the next sequential version + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.2'"); + + } + + if (CURRENT_DATABASE_VERSION == '0.9.2') { + mysqli_query($mysqli, "ALTER TABLE `account_types` ADD `account_type_parent` INT(11) NOT NULL DEFAULT 1 AFTER `account_type_id`"); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.3'"); + + } + //if (CURRENT_DATABASE_VERSION == '0.9.1') { // Insert queries here required to update to DB version 0.9.0 diff --git a/database_version.php b/database_version.php index a7270c3d..d7ebb9f0 100644 --- a/database_version.php +++ b/database_version.php @@ -5,5 +5,5 @@ * It is used in conjunction with database_updates.php */ -DEFINE("LATEST_DATABASE_VERSION", "0.9.2"); +DEFINE("LATEST_DATABASE_VERSION", "0.9.3"); diff --git a/db.sql b/db.sql index b21d0773..10c6f3b5 100644 --- a/db.sql +++ b/db.sql @@ -24,6 +24,7 @@ DROP TABLE IF EXISTS `account_types`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `account_types` ( `account_type_id` int(11) NOT NULL AUTO_INCREMENT, + `account_type_parent` int(11) NOT NULL DEFAULT 1, `account_type_name` varchar(255) NOT NULL, `account_type_description` text DEFAULT NULL, `account_type_created_at` datetime NOT NULL DEFAULT current_timestamp(), @@ -715,7 +716,7 @@ CREATE TABLE `invoices` ( `invoice_status` varchar(200) NOT NULL, `invoice_date` date NOT NULL, `invoice_due` date NOT NULL, - `invoice_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00, + `invoice_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00, `invoice_amount` decimal(15,2) NOT NULL DEFAULT 0.00, `invoice_currency_code` varchar(200) NOT NULL, `invoice_note` text DEFAULT NULL, @@ -938,9 +939,9 @@ CREATE TABLE `quotes` ( `quote_number` int(11) NOT NULL, `quote_scope` varchar(255) DEFAULT NULL, `quote_status` varchar(200) NOT NULL, + `quote_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00, `quote_date` date NOT NULL, `quote_expire` date DEFAULT NULL, - `quote_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00, `quote_amount` decimal(15,2) NOT NULL DEFAULT 0.00, `quote_currency_code` varchar(200) NOT NULL, `quote_note` text DEFAULT NULL, @@ -1743,4 +1744,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-10-16 17:19:49 +-- Dump completed on 2023-10-20 14:53:11