Feature: Recurring Payments created DB Structure

This commit is contained in:
johnnyq 2024-12-21 16:46:21 -05:00
parent 3e0e30a480
commit 63015ab22d
3 changed files with 47 additions and 5 deletions

View File

@ -2376,10 +2376,30 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
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
if (CURRENT_DATABASE_VERSION == '1.7.3') {
// Add Recurring Payments
mysqli_query($mysqli, "CREATE TABLE `recurring_payments` (
`recurring_payment_id` INT(11) NOT NULL AUTO_INCREMENT,
`recurring_payment_amount` DECIMAL(15,2) NOT NULL,
`recurring_payment_currency_code` VARCHAR(10) NOT NULL,
`recurring_payment_method` VARCHAR(200) NOT NULL,
`recurring_payment_created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
`recurring_payment_updated_at` DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`recurring_payment_archived_at` DATETIME DEFAULT NULL,
`recurring_payment_account_id` INT(11) NOT NULL,
`recurring_payment_recurring_expense_id` INT(11) NOT NULL DEFAULT 0,
`recurring_payment_recurring_invoice_id` INT(11) NOT NULL,
PRIMARY KEY (`recurring_payment_id`)
)");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.4'");
}
// if (CURRENT_DATABASE_VERSION == '1.7.4') {
// // Insert queries here required to update to DB version 1.7.5
// // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.4'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.5'");
// }
} else {

View File

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

24
db.sql
View File

@ -1383,6 +1383,28 @@ CREATE TABLE `recurring_expenses` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `recurring_payments`
--
DROP TABLE IF EXISTS `recurring_payments`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `recurring_payments` (
`recurring_payment_id` int(11) NOT NULL AUTO_INCREMENT,
`recurring_payment_amount` decimal(15,2) NOT NULL,
`recurring_payment_currency_code` varchar(10) NOT NULL,
`recurring_payment_method` varchar(200) NOT NULL,
`recurring_payment_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`recurring_payment_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`recurring_payment_archived_at` datetime DEFAULT NULL,
`recurring_payment_account_id` int(11) NOT NULL,
`recurring_payment_recurring_expense_id` int(11) NOT NULL DEFAULT 0,
`recurring_payment_recurring_invoice_id` int(11) NOT NULL,
PRIMARY KEY (`recurring_payment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `remember_tokens`
--
@ -2266,4 +2288,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-12-13 15:11:31
-- Dump completed on 2024-12-21 16:44:59