diff --git a/database_updates.php b/database_updates.php index 17ed18b8..56c14d7c 100644 --- a/database_updates.php +++ b/database_updates.php @@ -1236,11 +1236,28 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.1'"); } - //if (CURRENT_DATABASE_VERSION == '0.7.0') { - //Insert queries here required to update to DB version 0.7.1 + if (CURRENT_DATABASE_VERSION == '0.7.1') { + mysqli_query($mysqli, "CREATE TABLE `budget` ( + `budget_id` INT(11) NOT NULL AUTO_INCREMENT, + `budget_month` TINYINT NOT NULL, + `budget_year` TINYINT NOT NULL, + `budget_amount` DECIMAL(15,2) NOT NULL, + `budget_description` VARCHAR(255) DEFAULT NULL, + `budget_created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(), + `budget_updated_at` DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `budget_category_id` INT(11) NOT NULL, + PRIMARY KEY (`budget_id`) + )"); // Then, update the database to the next sequential version - //mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.1'"); + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.2'"); + } + + //if (CURRENT_DATABASE_VERSION == '0.7.2') { + //Insert queries here required to update to DB version 0.7.3 + + // Then, update the database to the next sequential version + //mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.3'"); //} } else { diff --git a/database_version.php b/database_version.php index 88a36d75..18f3e69b 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.7.1"); +DEFINE("LATEST_DATABASE_VERSION", "0.7.2"); diff --git a/db.sql b/db.sql index 6245a398..bfb6b3d8 100644 --- a/db.sql +++ b/db.sql @@ -148,6 +148,26 @@ CREATE TABLE `assets` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `budget` +-- + +DROP TABLE IF EXISTS `budget`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `budget` ( + `budget_id` int(11) NOT NULL AUTO_INCREMENT, + `budget_month` tinyint(4) NOT NULL, + `budget_year` tinyint(4) NOT NULL, + `budget_amount` decimal(15,2) NOT NULL, + `budget_description` varchar(255) DEFAULT NULL, + `budget_created_at` datetime NOT NULL DEFAULT current_timestamp(), + `budget_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), + `budget_category_id` int(11) NOT NULL, + PRIMARY KEY (`budget_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `calendars` -- @@ -1671,4 +1691,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-08-18 15:07:08 +-- Dump completed on 2023-08-18 18:20:52