Merge pull request #969 from acelaya-forks/feature/fix-role-name-length

Feature/fix role name length
This commit is contained in:
Alejandro Celaya 2021-01-18 17:34:49 +01:00 committed by GitHub
commit ea99b88c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 2 deletions

View File

@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
## [Unreleased]
### Added
* *Nothing*
### Changed
* *Nothing*
### Deprecated
* *Nothing*
### Removed
* *Nothing*
### Fixed
* [#968](https://github.com/shlinkio/shlink/issues/968) Fixed index error in MariaDB while updating to v2.5.0.
## [2.5.0] - 2021-01-17
### Added
* [#795](https://github.com/shlinkio/shlink/issues/795) and [#882](https://github.com/shlinkio/shlink/issues/882) Added new roles system to API keys.

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
{
}
}

View File

@ -24,7 +24,7 @@ return static function (ClassMetadata $metadata, array $emConfig): void {
$builder->createField('roleName', Types::STRING)
->columnName('role_name')
->length(256)
->length(255)
->nullable(false)
->build();