mirror of
https://github.com/vrana/adminer.git
synced 2026-03-24 21:40:03 +01:00
PostgreSQL: Export schema in REFERENCES
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
- PostgreSQL: Order NULL last
|
||||
- PostgreSQL: Display all SQL command warnings and only once
|
||||
- PostgreSQL: Export schema in nextval()
|
||||
- PostgreSQL: Export schema in REFERENCES
|
||||
- Editor: Display tinyint(1) as checkbox (bug #1246, regression from 5.4.2)
|
||||
- Croatian translation
|
||||
|
||||
|
||||
@@ -915,11 +915,12 @@ AND typelem = 0"
|
||||
$return = "";
|
||||
|
||||
$status = table_status1($table);
|
||||
$ns = idf_escape($status['nspname']);
|
||||
$fkeys = foreign_keys($table);
|
||||
ksort($fkeys);
|
||||
|
||||
foreach ($fkeys as $fkey_name => $fkey) {
|
||||
$return .= "ALTER TABLE ONLY " . idf_escape($status['nspname']) . "." . idf_escape($status['Name']) . " ADD CONSTRAINT " . idf_escape($fkey_name) . " $fkey[definition];\n";
|
||||
$return .= "ALTER TABLE ONLY $ns." . idf_escape($status['Name']) . " ADD CONSTRAINT " . idf_escape($fkey_name) . " " . preg_replace('~( REFERENCES )([^(.]+\()~', "\\1$ns.\\2", $fkey["definition"]) . ";\n";
|
||||
}
|
||||
|
||||
return ($return ? "$return\n" : $return);
|
||||
|
||||
Reference in New Issue
Block a user