| @@ 10-24 (lines=15) @@ | ||
| 7 | use OCP\Migration\ISchemaMigration; |
|
| 8 | ||
| 9 | /** Updates some fields to bigint if required */ |
|
| 10 | class Version20170804201253 implements ISchemaMigration { |
|
| 11 | public function changeSchema(Schema $schema, array $options) { |
|
| 12 | $prefix = $options['tablePrefix']; |
|
| 13 | ||
| 14 | if ($schema->hasTable("${prefix}files_trash")) { |
|
| 15 | $table = $schema->getTable("{$prefix}files_trash"); |
|
| 16 | ||
| 17 | $idColumn = $table->getColumn('auto_id'); |
|
| 18 | if ($idColumn && $idColumn->getType()->getName() !== Type::BIGINT) { |
|
| 19 | $idColumn->setType(Type::getType(Type::BIGINT)); |
|
| 20 | $idColumn->setOptions(['length' => 20]); |
|
| 21 | } |
|
| 22 | } |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| @@ 11-26 (lines=16) @@ | ||
| 8 | /** |
|
| 9 | * Updates column type in the share table from integer to bigint |
|
| 10 | */ |
|
| 11 | class Version20170711191432 implements ISchemaMigration { |
|
| 12 | ||
| 13 | public function changeSchema(Schema $schema, array $options) { |
|
| 14 | $prefix = $options['tablePrefix']; |
|
| 15 | ||
| 16 | if ($schema->hasTable("${prefix}share")) { |
|
| 17 | $table = $schema->getTable("{$prefix}share"); |
|
| 18 | ||
| 19 | $fileSourceColumn = $table->getColumn('file_source'); |
|
| 20 | if ($fileSourceColumn){ |
|
| 21 | $fileSourceColumn->setType(Type::getType(Type::BIGINT)); |
|
| 22 | $fileSourceColumn->setOptions(['length' => 20]); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||