Add contact_important DB field to database updater

This commit is contained in:
Marcus Hill
2023-01-01 11:25:12 +00:00
parent 807d374b90
commit ab34712bd9
2 changed files with 26 additions and 10 deletions
+18 -2
View File
@@ -378,13 +378,29 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.2'"); mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.2'");
} }
//if(CURRENT_DATABASE_VERSION == '0.2.2'){ if(CURRENT_DATABASE_VERSION == '0.2.2'){
// Insert queries here required to update to DB version 0.2.3 // Insert queries here required to update to DB version 0.2.3
// Add contact_important field to those who don't have it (installed before March 2022)
try {
mysqli_query($mysqli, "ALTER TABLE `contacts` ADD `contact_important` tinyint(1) NOT NULL DEFAULT 0 AFTER contact_password_hash;");
} catch (Exception $e) {
// Field already exists - that's fine
}
// Then, update the database to the next sequential version // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.2'"); mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.3'");
}
//if(CURRENT_DATABASE_VERSION == '0.2.3'){
// Insert queries here required to update to DB version 0.2.4
// Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.4'");
//} //}
}else{ }else{
// Up-to-date // Up-to-date
} }
+1 -1
View File
@@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php * It is used in conjunction with database_updates.php
*/ */
DEFINE("LATEST_DATABASE_VERSION", "0.2.2"); DEFINE("LATEST_DATABASE_VERSION", "0.2.3");