1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 23:27:17 +02:00

Foreign keys: Switch schema back after getting the tables

This commit is contained in:
Jakub Vrana
2025-02-26 15:57:52 +01:00
parent efb1eb9d6b
commit c38b967fc4
4 changed files with 11 additions and 3 deletions

View File

@@ -56,14 +56,18 @@ if ($row["db"] != "") {
$connection->select_db($row["db"]);
}
if ($row["ns"] != "") {
$orig_schema = get_schema();
set_schema($row["ns"]);
}
$referencable = array_keys(array_filter(table_status('', true), 'fk_support'));
$target = array_keys(fields(in_array($row["table"], $referencable) ? $row["table"] : reset($referencable)));
$onchange = "this.form['change-js'].value = '1'; this.form.submit();";
echo "<p>" . lang('Target table') . ": " . html_select("table", $referencable, $row["table"], $onchange) . "\n";
if ($jush == "pgsql") {
if (support("scheme")) {
echo lang('Schema') . ": " . html_select("ns", $adminer->schemas(), $row["ns"] != "" ? $row["ns"] : $_GET["ns"], $onchange);
if ($row["ns"] != "") {
set_schema($orig_schema);
}
} elseif ($jush != "sqlite") {
$dbs = array();
foreach ($adminer->databases() as $db) {