mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-16 15:08:54 +00:00
[ticket/17528] Fix phpBB PostgreSQL platform [ci skip]
PHPBB-17528
This commit is contained in:
parent
43833b40bb
commit
9cccf26311
1 changed files with 30 additions and 0 deletions
|
@ -78,6 +78,36 @@ class postgresql_platform extends PostgreSQL94Platform
|
|||
return AbstractPlatform::getDefaultValueDeclarationSQL($column);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAlterTableSQL(TableDiff $diff)
|
||||
{
|
||||
$sql = parent::getAlterTableSQL($diff);
|
||||
$table_name = $diff->getOldTable()->getName();
|
||||
$columns = array_merge($diff->getAddedColumns(), $diff->getModifiedColumns());
|
||||
$post_sql = $sequence_sql = [];
|
||||
|
||||
foreach ($columns as $column)
|
||||
{
|
||||
$column_name = $column->getName();
|
||||
if (!empty($column->getAutoincrement()))
|
||||
{
|
||||
$sequence = new Sequence($this->getIdentitySequenceName($table_name, $column_name));
|
||||
$sequence_sql[] = $this->getCreateSequenceSQL($sequence);
|
||||
$post_sql[] = 'ALTER SEQUENCE '.$sequence->getName().' OWNED BY ' . $table_name . '.' . $column_name;
|
||||
}
|
||||
}
|
||||
$sql = array_merge($sequence_sql, $sql, $post_sql);
|
||||
|
||||
foreach ($sql as $i => $query)
|
||||
{
|
||||
$sql[$i] = str_replace('{{placeholder_sequence}}', "nextval('{$table_name}_seq')", $query);
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue