mirror of https://github.com/itflow-org/itflow
Fix DB Update database version was set it 0.8.10 which caused it not to update instead chnaged it to 0.9.0. items table also does not exist updated to invoices items for the new sort function redumped DB Structure.
This commit is contained in:
parent
d0312e75cb
commit
fba1115b0d
|
|
@ -1435,18 +1435,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
// Uncomment Below Lines, to add additional database updates
|
||||
//
|
||||
if (CURRENT_DATABASE_VERSION == '0.8.9') {
|
||||
// Insert queries here required to update to DB version 0.8.9
|
||||
// Insert queries here required to update to DB version 0.9.0
|
||||
// Update existing quotes and recurrings so that item_order is set to item_id
|
||||
$sql_quotes = mysqli_query($mysqli, "SELECT quote_id FROM quotes WHERE quote_id IS NOT NULL");
|
||||
$sql_recurrings = mysqli_query($mysqli, "SELECT recurring_id FROM recurring WHERE recurring_id IS NOT NULL");
|
||||
|
||||
foreach ($sql_quotes as $row) {
|
||||
$quote_id = $row['quote_id'];
|
||||
$sql_quote_items = mysqli_query($mysqli, "SELECT item_id FROM quote_items WHERE item_quote_id = '$quote_id' ORDER BY item_id ASC");
|
||||
$sql_quote_items = mysqli_query($mysqli, "SELECT item_id FROM invoice_items WHERE item_quote_id = '$quote_id' ORDER BY item_id ASC");
|
||||
$item_order = 1;
|
||||
foreach ($sql_quote_items as $row) {
|
||||
$item_id = $row['item_id'];
|
||||
mysqli_query($mysqli, "UPDATE quote_items SET item_order = '$item_order' WHERE item_id = '$item_id'");
|
||||
mysqli_query($mysqli, "UPDATE invoice_items SET item_order = '$item_order' WHERE item_id = '$item_id'");
|
||||
$item_order++;
|
||||
//Log changes made to quote
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Quote', log_action = 'Modify', log_description = 'Updated item_order to item_id: $item_order'");
|
||||
|
|
@ -1455,11 +1455,11 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
|
||||
foreach ($sql_recurrings as $row) {
|
||||
$recurring_id = $row['recurring_id'];
|
||||
$sql_recurring_items = mysqli_query($mysqli, "SELECT item_id FROM recurring_items WHERE item_recurring_id = '$recurring_id' ORDER BY item_id ASC");
|
||||
$sql_recurring_items = mysqli_query($mysqli, "SELECT item_id FROM invoice_items WHERE item_recurring_id = '$recurring_id' ORDER BY item_id ASC");
|
||||
$item_order = 1;
|
||||
foreach ($sql_recurring_items as $row) {
|
||||
$item_id = $row['item_id'];
|
||||
mysqli_query($mysqli, "UPDATE recurring_items SET item_order = '$item_order' WHERE item_id = '$item_id'");
|
||||
mysqli_query($mysqli, "UPDATE invoice_items SET item_order = '$item_order' WHERE item_id = '$item_id'");
|
||||
$item_order++;
|
||||
//Log changes made to recurring
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Recurring', log_action = 'Modify', log_description = 'Updated item_order to item_id: $item_order'");
|
||||
|
|
@ -1469,7 +1469,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
|
||||
//
|
||||
// Then, update the database to the next sequential version
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.8.10'");
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.0'");
|
||||
}
|
||||
//
|
||||
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.8.10");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.9.0");
|
||||
|
|
|
|||
39
db.sql
39
db.sql
|
|
@ -1,8 +1,8 @@
|
|||
-- MariaDB dump 10.19 Distrib 10.11.3-MariaDB, for debian-linux-gnu (x86_64)
|
||||
-- MariaDB dump 10.19 Distrib 10.11.4-MariaDB, for debian-linux-gnu (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: itflow_dev
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.11.3-MariaDB-1
|
||||
-- Server version 10.11.4-MariaDB-1~deb12u1
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
|
|
@ -15,6 +15,24 @@
|
|||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `account_types`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `account_types`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `account_types` (
|
||||
`account_type_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`account_type_name` varchar(255) NOT NULL,
|
||||
`account_type_description` text DEFAULT NULL,
|
||||
`account_type_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`account_type_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`account_type_archived_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`account_type_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `accounts`
|
||||
--
|
||||
|
|
@ -28,7 +46,7 @@ CREATE TABLE `accounts` (
|
|||
`opening_balance` decimal(15,2) NOT NULL DEFAULT 0.00,
|
||||
`account_currency_code` varchar(200) NOT NULL,
|
||||
`account_notes` text DEFAULT NULL,
|
||||
`account_type` int(6) NOT NULL DEFAULT 0,
|
||||
`account_type` int(6) DEFAULT NULL,
|
||||
`account_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`account_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`account_archived_at` datetime DEFAULT NULL,
|
||||
|
|
@ -36,19 +54,6 @@ CREATE TABLE `accounts` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
DROP TABLE IF EXISTS `account_types`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `account_types` (
|
||||
`account_type_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`account_type_name` varchar(200) NOT NULL,
|
||||
`account_type_description` text DEFAULT NULL,
|
||||
`account_type_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`account_type_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`account_type_archived_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`account_type_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
--
|
||||
-- Table structure for table `api_keys`
|
||||
--
|
||||
|
|
@ -1734,4 +1739,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2023-09-24 20:31:22
|
||||
-- Dump completed on 2023-10-16 17:19:49
|
||||
|
|
|
|||
Loading…
Reference in New Issue