Issue #1013034 by ncl: Fixed PostgreSQL constraints do not get renamed by db_rename_table().
parent
29dba9a4a8
commit
df5c8687f1
|
@ -328,9 +328,9 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
|
|||
// rename them when renaming the table.
|
||||
$indexes = $this->connection->query('SELECT indexname FROM pg_indexes WHERE schemaname = :schema AND tablename = :table', array(':schema' => $old_schema, ':table' => $old_table_name));
|
||||
foreach ($indexes as $index) {
|
||||
if (preg_match('/^' . preg_quote($old_full_name) . '_(.*)_idx$/', $index->indexname, $matches)) {
|
||||
if (preg_match('/^' . preg_quote($old_full_name) . '_(.*)$/', $index->indexname, $matches)) {
|
||||
$index_name = $matches[1];
|
||||
$this->connection->query('ALTER INDEX ' . $index->indexname . ' RENAME TO {' . $new_name . '}_' . $index_name . '_idx');
|
||||
$this->connection->query('ALTER INDEX ' . $index->indexname . ' RENAME TO {' . $new_name . '}_' . $index_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue