Fix Regression that broke setup, set company currency default to USD if not set

This commit is contained in:
johnnyq 2025-06-21 18:33:48 -04:00
parent 5c6a7acb7d
commit c4e91df1ed
3 changed files with 12 additions and 7 deletions

View File

@ -3670,13 +3670,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.9'");
}
// if (CURRENT_DATABASE_VERSION == '2.1.9') {
// // Insert queries here required to update to DB version 2.2.0
if (CURRENT_DATABASE_VERSION == '2.1.9') {
mysqli_query($mysqli, "ALTER TABLE `companies` MODIFY `company_currency` VARCHAR(200) DEFAULT 'USD'");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.0'");
}
// if (CURRENT_DATABASE_VERSION == '2.2.0') {
// // Insert queries here required to update to DB version 2.2.1
// // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.0'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.1'");
// }
} else {
// Up-to-date
}

4
db.sql
View File

@ -554,7 +554,7 @@ CREATE TABLE `companies` (
`company_website` varchar(200) DEFAULT NULL,
`company_logo` varchar(250) DEFAULT NULL,
`company_locale` varchar(200) DEFAULT NULL,
`company_currency` varchar(200) NOT NULL,
`company_currency` varchar(200) DEFAULT 'USD',
`company_tax_id` varchar(200) DEFAULT NULL,
`company_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`company_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
@ -2590,4 +2590,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-06-17 22:44:10
-- Dump completed on 2025-06-21 18:33:02

View File

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