Get alters for table if there is a difference.
{
$oldFields = $this->db->getTableColumns($table);
$oldKeys = $this->db->getTableKeys($table);
$oldSequence = $this->db->getTableSequences($table);
$alters = array();
$newFields = $structure->xpath('field');
$newKeys = $structure->xpath('key');
$newSequence = $structure->xpath('sequence');
foreach ($newSequenceLook as $kSeqName => $vSeq)
{
if (isset($oldSeq[$kSeqName]))
{
$column = $oldSeq[$kSeqName][0];
if (version_compare($this->db->getVersion(), '9.1.0') < 0)
{
$column->Min_Value = '1';
$column->Max_Value = '9223372036854775807';
$column->Increment = '1';
$column->Cycle_option = 'NO';
$column->Start_Value = '1';
}
$change = ((string) $vSeq[0]['Type'] != $column->Type) || ((string) $vSeq[0]['Start_Value'] != $column->Start_Value)
|| ((string) $vSeq[0]['Min_Value'] != $column->Min_Value) || ((string) $vSeq[0]['Max_Value'] != $column->Max_Value)
|| ((string) $vSeq[0]['Increment'] != $column->Increment) || ((string) $vSeq[0]['Cycle_option'] != $column->Cycle_option)
|| ((string) $vSeq[0]['Table'] != $column->Table) || ((string) $vSeq[0]['Column'] != $column->Column)
|| ((string) $vSeq[0]['Schema'] != $column->Schema) || ((string) $vSeq[0]['Name'] != $column->Name);
if ($change)
{
}
unset($oldSeq[$kSeqName]);
}
else
{
}
}
foreach ($oldSeq as $name => $column)
{
}
foreach ($newFields as $field)
{
$fName = (string) $field['Field'];
if (isset($oldFields[$fName]))
{
$column = $oldFields[$fName];
$change = ((string) $field['Type'] != $column->Type) || ((string) $field['Null'] != $column->Null)
|| ((string) $field['Default'] != $column->Default);
if ($change)
{
}
unset($oldFields[$fName]);
}
else
{
}
}
foreach ($oldFields as $name => $column)
{
}
foreach ($newLookup as $name => $keys)
{
if (isset($oldLookup[$name]))
{
$same = true;
$newCount = count($newLookup[$name]);
$oldCount = count($oldLookup[$name]);
if ($newCount == $oldCount)
{
for ($i = 0; $i < $newCount; $i++)
{
$same = ((string) $newLookup[$name][$i]['Query'] == $oldLookup[$name][$i]->Query);
if (!$same)
{
break;
}
}
}
else
{
$same = false;
}
if (!$same)
{
$alters[] = (string) $newLookup[$name][0]['Query'];
}
unset($oldLookup[$name]);
}
else
{
$alters[] = (string) $newLookup[$name][0]['Query'];
}
}
foreach ($oldLookup as $name => $keys)
{
if ($oldLookup[$name][0]->is_primary == 'TRUE')
{
}
else
{
}
}
return $alters;
}