mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
add more checks to schema changes
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9349 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
dd059c15b6
commit
88a74afa58
1 changed files with 28 additions and 12 deletions
|
@ -533,7 +533,7 @@ class phpbb_db_tools
|
||||||
* {KEY/INDEX NAME} => array({COLUMN NAMES}),
|
* {KEY/INDEX NAME} => array({COLUMN NAMES}),
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* For more information have a look at /develop/create_schema_files.php (only available through CVS)
|
* For more information have a look at /develop/create_schema_files.php (only available through SVN)
|
||||||
*/
|
*/
|
||||||
function perform_schema_changes($schema_changes)
|
function perform_schema_changes($schema_changes)
|
||||||
{
|
{
|
||||||
|
@ -551,7 +551,15 @@ class phpbb_db_tools
|
||||||
{
|
{
|
||||||
foreach ($columns as $column_name => $column_data)
|
foreach ($columns as $column_name => $column_data)
|
||||||
{
|
{
|
||||||
$result = $this->sql_column_change($table, $column_name, $column_data);
|
// If the column exists we change it, else we add it ;)
|
||||||
|
if ($this->sql_column_exists($table, $column_name))
|
||||||
|
{
|
||||||
|
$result = $this->sql_column_change($table, $column_name, $column_data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = $this->sql_column_add($table, $column_name, $column_data);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->return_statements)
|
if ($this->return_statements)
|
||||||
{
|
{
|
||||||
|
@ -568,15 +576,19 @@ class phpbb_db_tools
|
||||||
{
|
{
|
||||||
foreach ($columns as $column_name => $column_data)
|
foreach ($columns as $column_name => $column_data)
|
||||||
{
|
{
|
||||||
// Only add the column if it does not exist yet
|
// Only add the column if it does not exist yet, else change it (to be consistent)
|
||||||
if (!$this->sql_column_exists($table, $column_name))
|
if ($this->sql_column_exists($table, $column_name))
|
||||||
|
{
|
||||||
|
$result = $this->sql_column_change($table, $column_name, $column_data);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$result = $this->sql_column_add($table, $column_name, $column_data);
|
$result = $this->sql_column_add($table, $column_name, $column_data);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->return_statements)
|
if ($this->return_statements)
|
||||||
{
|
{
|
||||||
$statements = array_merge($statements, $result);
|
$statements = array_merge($statements, $result);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,11 +618,15 @@ class phpbb_db_tools
|
||||||
{
|
{
|
||||||
foreach ($columns as $column)
|
foreach ($columns as $column)
|
||||||
{
|
{
|
||||||
$result = $this->sql_column_remove($table, $column);
|
// Only remove the column if it exists...
|
||||||
|
if ($this->sql_column_exists($table, $column))
|
||||||
if ($this->return_statements)
|
|
||||||
{
|
{
|
||||||
$statements = array_merge($statements, $result);
|
$result = $this->sql_column_remove($table, $column);
|
||||||
|
|
||||||
|
if ($this->return_statements)
|
||||||
|
{
|
||||||
|
$statements = array_merge($statements, $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue