Fixed migrations so that api_key_roles index does not fail

This commit is contained in:
Alejandro Celaya 2021-01-18 17:14:46 +01:00
parent 47d86b58a3
commit eef49478fc
2 changed files with 27 additions and 1 deletions

View file

@ -25,7 +25,7 @@ final class Version20210102174433 extends AbstractMigration
$table->setPrimaryKey(['id']);
$table->addColumn('role_name', Types::STRING, [
'length' => 256,
'length' => 255,
'notnull' => true,
]);
$table->addColumn('meta', Types::JSON, [

View file

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace ShlinkMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20210118153932 extends AbstractMigration
{
public function up(Schema $schema): void
{
// Prev migration used to set the length to 256, which made some set-ups crash
// It has been updated to 255, and this migration ensures whoever managed to run the prev one, gets the value
// also updated to 255
$rolesTable = $schema->getTable('api_key_roles');
$nameColumn = $rolesTable->getColumn('role_name');
$nameColumn->setLength(255);
}
public function down(Schema $schema): void
{
}
}