From b8cdc29d8f71d7ea0cfd994cfa080e2d9ffb5c3b Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 20 Oct 2019 09:53:11 +0200 Subject: [PATCH] Increased long URL size in DB to 2048 characters --- data/migrations/Version20191020074522.php | 37 +++++++++++++++++++ data/migrations_template.txt | 1 + docker-compose.yml | 1 + .../Shlinkio.Shlink.Core.Entity.ShortUrl.php | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 data/migrations/Version20191020074522.php diff --git a/data/migrations/Version20191020074522.php b/data/migrations/Version20191020074522.php new file mode 100644 index 00000000..baf1ce7a --- /dev/null +++ b/data/migrations/Version20191020074522.php @@ -0,0 +1,37 @@ +getOriginalUrlColumn($schema)->setLength(2048); + } + + /** + * @throws SchemaException + */ + public function down(Schema $schema): void + { + $this->getOriginalUrlColumn($schema)->setLength(1024); + } + + /** + * @throws SchemaException + */ + private function getOriginalUrlColumn(Schema $schema): Column + { + return $schema->getTable('short_urls')->getColumn('original_url'); + } +} diff --git a/data/migrations_template.txt b/data/migrations_template.txt index 2e3e1edb..c7b938f2 100644 --- a/data/migrations_template.txt +++ b/data/migrations_template.txt @@ -1,4 +1,5 @@ ; diff --git a/docker-compose.yml b/docker-compose.yml index 34b9c64e..630ab955 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -78,6 +78,7 @@ services: environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: shlink + MYSQL_INITDB_SKIP_TZINFO: 1 shlink_redis: container_name: shlink_redis diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php index 8dd6dc49..76e5ae7b 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php @@ -24,7 +24,7 @@ $builder->createField('id', Type::BIGINT) $builder->createField('longUrl', Type::STRING) ->columnName('original_url') - ->length(1024) + ->length(2048) ->build(); $builder->createField('shortCode', Type::STRING)