mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +01:00
fix RenameTable for PostgreSQL to only use old logic, if we still have an old sequence, and if old logic is used, set sequence value
This commit is contained in:
parent
27468f0dac
commit
c033435122
@ -371,12 +371,15 @@ class Schema
|
||||
{
|
||||
if (!($table_def = $this->GetTableDefinition($sOldTableName))) return 0;
|
||||
|
||||
if ($this->_PostgresHasOldSequence($sOldTableName,True) || count($table_def['pk']) ||
|
||||
count($table_def['ix']) || count($table_def['uc']))
|
||||
// only use old PostgreSQL stuff, if we have an old sequence, otherwise rely on it being new enough
|
||||
if ($this->_PostgresHasOldSequence($sOldTableName,True) &&
|
||||
(count($table_def['pk']) || count($table_def['ix']) || count($table_def['uc'])))
|
||||
{
|
||||
if ($this->adodb->BeginTrans() &&
|
||||
$this->CreateTable($sNewTableName,$table_def,True) &&
|
||||
$this->m_odb->query("INSERT INTO $sNewTableName SELECT * FROM $sOldTableName",__LINE__,__FILE__) &&
|
||||
// sequence must be updated, after inserts containing pkey, otherwise new inserst will fail!
|
||||
(count($table_def['pk']) !== 1 || $this->UpdateSequence($sNewTableName, $table_def['pk'][0])) &&
|
||||
$this->DropTable($sOldTableName))
|
||||
{
|
||||
$this->adodb->CommitTrans();
|
||||
|
Loading…
Reference in New Issue
Block a user