Feature - Budgets - Part 1 - DB Structure Created

This commit is contained in:
johnnyq 2023-08-18 18:21:25 -04:00
parent 258287ae0c
commit adf313f183
3 changed files with 42 additions and 5 deletions

View File

@ -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 {

View File

@ -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");

22
db.sql
View File

@ -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