return $tables;
} /**
* {@inheritdoc}
*/
public function renameTable($table,
$new_name) { if (!
$this->
tableExists($table)) { throw new SchemaObjectDoesNotExistException("Cannot rename '
$table' to '
$new_name': table '
$table' doesn't exist."
);
} if ($this->
tableExists($new_name)) { throw new SchemaObjectExistsException("Cannot rename '
$table' to '
$new_name': table '
$new_name' already exists."
);
} // Get the schema and tablename for the old table.
$table_name =
$this->connection->
getPrefix() .
$table;
// Index names and constraint names are global in PostgreSQL, so we need to
// rename them when renaming the table.
$indexes =
$this->connection->
query('SELECT indexname FROM pg_indexes WHERE schemaname = :schema AND tablename = :table',
[':schema' =>
$this->defaultSchema, ':table' =>
$table_name]);
foreach ($indexes as $index) { // Get the index type by suffix, e.g. idx/key/pkey.
$index_type =
substr($index->indexname,
strrpos($index->indexname, '_'
) + 1
);