-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28086 from owncloud/migration-col-length
Fix column lengths on migrations table to fix index
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
namespace OC\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** | ||
* Updates the column lengths for the migrations table to reflect changes in its schema | ||
*/ | ||
class Version20170605143658 implements ISchemaMigration { | ||
|
||
public function changeSchema(Schema $schema, array $options) { | ||
// Get the table | ||
$prefix = $options['tablePrefix']; | ||
$table = $schema->getTable("{$prefix}migrations"); | ||
|
||
// Check column length to see if migration is necessary necessary | ||
if($table->getColumn('app')->getLength() === 177) { | ||
// then this server was installed after the fix | ||
return; | ||
} | ||
|
||
// Need to shorten columns | ||
$table->getColumn('app')->setLength(177); | ||
$table->getColumn('version')->setLength(14); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters