Call the update_indexes method when updating the Schema

This commit is contained in:
markjcrane
2025-11-28 16:51:22 -07:00
parent 73a85cf57f
commit 374713e7c6
3 changed files with 30 additions and 0 deletions

View File

@@ -148,9 +148,20 @@
//load an array of the database schema and compare it with the active database //load an array of the database schema and compare it with the active database
if (!empty($action["upgrade_schema"]) && permission_exists("upgrade_schema")) { if (!empty($action["upgrade_schema"]) && permission_exists("upgrade_schema")) {
//update the database schema and types
$obj = new schema(['database' => $database]); $obj = new schema(['database' => $database]);
$_SESSION["response"]["schema"] = $obj->schema("html"); $_SESSION["response"]["schema"] = $obj->schema("html");
message::add($text['message-upgrade_schema'], null, $message_timeout); message::add($text['message-upgrade_schema'], null, $message_timeout);
//update database foreign key indexes
$response = $database->update_indexes();
if (!empty($response)) {
//echo "<table>\n";
foreach($response as $row) {
echo " ".trim($row['sql'])."<br />\n";
}
//echo "</table>\n";
}
} }
//process the apps defaults //process the apps defaults

View File

@@ -235,6 +235,14 @@
echo " ".trim($row)."\n"; echo " ".trim($row)."\n";
} }
} }
//update database foreign key indexes
$response = $database->update_indexes();
if ($display_type === 'text') {
foreach($response as $row) {
echo " ".trim($row['sql'])."\n";
}
}
} }

View File

@@ -347,9 +347,20 @@ function do_upgrade_domains() {
* @return void * @return void
*/ */
function do_upgrade_schema() { function do_upgrade_schema() {
//define the global variables
global $database;
//get the database schema put it into an array then compare and update the database as needed. //get the database schema put it into an array then compare and update the database as needed.
$obj = new schema(); $obj = new schema();
echo $obj->schema('text'); echo $obj->schema('text');
//update the database foreign key indexes
$response = $database->update_indexes();
if ($display_type === 'text') {
foreach($response as $row) {
echo " ".trim($row['sql'])."\n";
}
}
} }
/** /**