diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2014-05-28 23:33:45 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2014-05-28 23:33:45 +0200 |
| commit | 6df911142c6ba43d1222f4235fbedb1628edf27a (patch) | |
| tree | d1bd11a0eaa84104ac11ed92c2cd6b3437bb6918 /phpBB/phpbb | |
| parent | 480a70ccaef2a99d8cf69cf24abb8d69bf3464d2 (diff) | |
| parent | 033df350d956121388b7b9be8f1b0f1d1439d2e4 (diff) | |
| download | forums-6df911142c6ba43d1222f4235fbedb1628edf27a.tar forums-6df911142c6ba43d1222f4235fbedb1628edf27a.tar.gz forums-6df911142c6ba43d1222f4235fbedb1628edf27a.tar.bz2 forums-6df911142c6ba43d1222f4235fbedb1628edf27a.tar.xz forums-6df911142c6ba43d1222f4235fbedb1628edf27a.zip | |
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus:
[ticket/12561] Reworked tests by nickvergessen
[ticket/12561] Added tests for "after last", "after missing" and "empty"
[ticket/12561] Add check to see if "after" column actually exists
[ticket/12561] Added test for "after"
[ticket/12561] Add "after" check to schema_generator for columns_add
Diffstat (limited to 'phpBB/phpbb')
| -rw-r--r-- | phpBB/phpbb/db/migration/schema_generator.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php index 871fd97aca..818e27a362 100644 --- a/phpBB/phpbb/db/migration/schema_generator.php +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -109,7 +109,25 @@ class schema_generator { foreach ($add_columns as $column => $column_data) { - $this->tables[$table]['COLUMNS'][$column] = $column_data; + if (isset($column_data['after'])) + { + $columns = $this->tables[$table]['COLUMNS']; + $offset = array_search($column_data['after'], array_keys($columns)); + unset($column_data['after']); + + if ($offset === false) + { + $this->tables[$table]['COLUMNS'][$column] = array_values($column_data); + } + else + { + $this->tables[$table]['COLUMNS'] = array_merge(array_slice($columns, 0, $offset + 1, true), array($column => array_values($column_data)), array_slice($columns, $offset)); + } + } + else + { + $this->tables[$table]['COLUMNS'][$column] = $column_data; + } } } } |
