@@ -11,15 +11,15 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class Version1002Date20170919101419 extends BigIntMigration { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @return array Returns an array with the following structure |
|
| 16 | - * ['table1' => ['column1', 'column2'], ...] |
|
| 17 | - * @since 13.0.0 |
|
| 18 | - */ |
|
| 19 | - protected function getColumnsByTable() { |
|
| 20 | - return [ |
|
| 21 | - 'twofactor_backupcodes' => ['id'], |
|
| 22 | - ]; |
|
| 23 | - } |
|
| 14 | + /** |
|
| 15 | + * @return array Returns an array with the following structure |
|
| 16 | + * ['table1' => ['column1', 'column2'], ...] |
|
| 17 | + * @since 13.0.0 |
|
| 18 | + */ |
|
| 19 | + protected function getColumnsByTable() { |
|
| 20 | + return [ |
|
| 21 | + 'twofactor_backupcodes' => ['id'], |
|
| 22 | + ]; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | } |
@@ -11,25 +11,25 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class Version1004Date20170919103422 extends BigIntMigration { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @return array Returns an array with the following structure |
|
| 16 | - * ['table1' => ['column1', 'column2'], ...] |
|
| 17 | - * @since 13.0.0 |
|
| 18 | - */ |
|
| 19 | - protected function getColumnsByTable() { |
|
| 20 | - return [ |
|
| 21 | - 'addressbooks' => ['id'], |
|
| 22 | - 'addressbookchanges' => ['id', 'addressbookid'], |
|
| 23 | - 'calendars' => ['id', 'calendarid'], |
|
| 24 | - 'calendarchanges' => ['id', 'calendarid'], |
|
| 25 | - 'calendarobjects' => ['id', 'calendarid'], |
|
| 26 | - 'calendarobjects_props' => ['id', 'calendarid', 'objectid'], |
|
| 27 | - 'calendarsubscriptions' => ['id', 'calendarid'], |
|
| 28 | - 'cards' => ['id', 'addressbookid'], |
|
| 29 | - 'cards_properties' => ['id', 'addressbookid', 'cardid'], |
|
| 30 | - 'dav_shares' => ['id', 'resourceid'], |
|
| 31 | - 'schedulingobjects' => ['id', 'addressbookid'], |
|
| 32 | - ]; |
|
| 33 | - } |
|
| 14 | + /** |
|
| 15 | + * @return array Returns an array with the following structure |
|
| 16 | + * ['table1' => ['column1', 'column2'], ...] |
|
| 17 | + * @since 13.0.0 |
|
| 18 | + */ |
|
| 19 | + protected function getColumnsByTable() { |
|
| 20 | + return [ |
|
| 21 | + 'addressbooks' => ['id'], |
|
| 22 | + 'addressbookchanges' => ['id', 'addressbookid'], |
|
| 23 | + 'calendars' => ['id', 'calendarid'], |
|
| 24 | + 'calendarchanges' => ['id', 'calendarid'], |
|
| 25 | + 'calendarobjects' => ['id', 'calendarid'], |
|
| 26 | + 'calendarobjects_props' => ['id', 'calendarid', 'objectid'], |
|
| 27 | + 'calendarsubscriptions' => ['id', 'calendarid'], |
|
| 28 | + 'cards' => ['id', 'addressbookid'], |
|
| 29 | + 'cards_properties' => ['id', 'addressbookid', 'cardid'], |
|
| 30 | + 'dav_shares' => ['id', 'resourceid'], |
|
| 31 | + 'schedulingobjects' => ['id', 'addressbookid'], |
|
| 32 | + ]; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | } |
@@ -29,38 +29,38 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | abstract class BigIntMigration extends SimpleMigrationStep { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return array Returns an array with the following structure |
|
| 34 | - * ['table1' => ['column1', 'column2'], ...] |
|
| 35 | - * @since 13.0.0 |
|
| 36 | - */ |
|
| 37 | - abstract protected function getColumnsByTable(); |
|
| 32 | + /** |
|
| 33 | + * @return array Returns an array with the following structure |
|
| 34 | + * ['table1' => ['column1', 'column2'], ...] |
|
| 35 | + * @since 13.0.0 |
|
| 36 | + */ |
|
| 37 | + abstract protected function getColumnsByTable(); |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param IOutput $output |
|
| 41 | - * @param \Closure $schemaClosure The `\Closure` returns a `Schema` |
|
| 42 | - * @param array $options |
|
| 43 | - * @return null|Schema |
|
| 44 | - * @since 13.0.0 |
|
| 45 | - */ |
|
| 46 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 47 | - /** @var Schema $schema */ |
|
| 48 | - $schema = $schemaClosure(); |
|
| 39 | + /** |
|
| 40 | + * @param IOutput $output |
|
| 41 | + * @param \Closure $schemaClosure The `\Closure` returns a `Schema` |
|
| 42 | + * @param array $options |
|
| 43 | + * @return null|Schema |
|
| 44 | + * @since 13.0.0 |
|
| 45 | + */ |
|
| 46 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 47 | + /** @var Schema $schema */ |
|
| 48 | + $schema = $schemaClosure(); |
|
| 49 | 49 | |
| 50 | - $tables = $this->getColumnsByTable(); |
|
| 50 | + $tables = $this->getColumnsByTable(); |
|
| 51 | 51 | |
| 52 | - foreach ($tables as $tableName => $columns) { |
|
| 53 | - $table = $schema->getTable($tableName); |
|
| 52 | + foreach ($tables as $tableName => $columns) { |
|
| 53 | + $table = $schema->getTable($tableName); |
|
| 54 | 54 | |
| 55 | - foreach ($columns as $columnName) { |
|
| 56 | - $column = $table->getColumn($columnName); |
|
| 57 | - if ($column->getType()->getName() !== Type::BIGINT) { |
|
| 58 | - $column->setType(Type::getType(Type::BIGINT)); |
|
| 59 | - $column->setOptions(['length' => 20]); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - } |
|
| 55 | + foreach ($columns as $columnName) { |
|
| 56 | + $column = $table->getColumn($columnName); |
|
| 57 | + if ($column->getType()->getName() !== Type::BIGINT) { |
|
| 58 | + $column->setType(Type::getType(Type::BIGINT)); |
|
| 59 | + $column->setOptions(['length' => 20]); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return $schema; |
|
| 65 | - } |
|
| 64 | + return $schema; |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -11,32 +11,32 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class Version13000Date20170919101637 extends BigIntMigration { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @return array Returns an array with the following structure |
|
| 16 | - * ['table1' => ['column1', 'column2'], ...] |
|
| 17 | - * @since 13.0.0 |
|
| 18 | - */ |
|
| 19 | - protected function getColumnsByTable() { |
|
| 20 | - return [ |
|
| 21 | - 'admin_settings' => ['id'], |
|
| 22 | - 'authtoken' => ['id'], |
|
| 23 | - 'bruteforce_attempts' => ['id'], |
|
| 24 | - 'comments' => ['id', 'parent_id', 'topmost_parent_id'], |
|
| 25 | - 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart'], |
|
| 26 | - 'file_locks' => ['id'], |
|
| 27 | - 'jobs' => ['id'], |
|
| 28 | - 'mimetypes' => ['id'], |
|
| 29 | - 'mounts' => ['id'], |
|
| 30 | - 'personal_settings' => ['id'], |
|
| 31 | - 'properties' => ['id'], |
|
| 32 | - 'share' => ['id', 'parent', 'file_source'], |
|
| 33 | - 'storages' => ['numeric_id'], |
|
| 34 | - 'systemtag' => ['id'], |
|
| 35 | - 'systemtag_group' => ['systemtagid'], |
|
| 36 | - 'systemtag_object_mapping' => ['systemtagid'], |
|
| 37 | - 'vcategory' => ['id'], |
|
| 38 | - 'vcategory_to_object' => ['objid', 'categoryid'], |
|
| 39 | - ]; |
|
| 40 | - } |
|
| 14 | + /** |
|
| 15 | + * @return array Returns an array with the following structure |
|
| 16 | + * ['table1' => ['column1', 'column2'], ...] |
|
| 17 | + * @since 13.0.0 |
|
| 18 | + */ |
|
| 19 | + protected function getColumnsByTable() { |
|
| 20 | + return [ |
|
| 21 | + 'admin_settings' => ['id'], |
|
| 22 | + 'authtoken' => ['id'], |
|
| 23 | + 'bruteforce_attempts' => ['id'], |
|
| 24 | + 'comments' => ['id', 'parent_id', 'topmost_parent_id'], |
|
| 25 | + 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart'], |
|
| 26 | + 'file_locks' => ['id'], |
|
| 27 | + 'jobs' => ['id'], |
|
| 28 | + 'mimetypes' => ['id'], |
|
| 29 | + 'mounts' => ['id'], |
|
| 30 | + 'personal_settings' => ['id'], |
|
| 31 | + 'properties' => ['id'], |
|
| 32 | + 'share' => ['id', 'parent', 'file_source'], |
|
| 33 | + 'storages' => ['numeric_id'], |
|
| 34 | + 'systemtag' => ['id'], |
|
| 35 | + 'systemtag_group' => ['systemtagid'], |
|
| 36 | + 'systemtag_object_mapping' => ['systemtagid'], |
|
| 37 | + 'vcategory' => ['id'], |
|
| 38 | + 'vcategory_to_object' => ['objid', 'categoryid'], |
|
| 39 | + ]; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | } |