-
-
Notifications
You must be signed in to change notification settings - Fork 292
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 #1691 from shlinkio/develop
Release 3.5.1
- Loading branch information
Showing
17 changed files
with
139 additions
and
44 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<!-- | ||
Before opening an issue, just take into account that this is a completely free of charge and open source project. | ||
I'm always happy to help and provide support, but some understanding will be expected. | ||
I do this in my own free time, so expect some delays when implementing new features and fixing bugs, and don't take it personal if an issue gets eventually closed. | ||
I do this in my own free time, so expect some delays when implementing new features and fixing bugs, and don't take it personally if an issue gets eventually closed. | ||
You may also be asked to provide tests or ways to reproduce reported bugs. | ||
Try to be polite, and understand it is impossible for an OSS project to cover all use cases. | ||
--> |
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
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
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
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
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
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
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
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,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ShlinkMigrations; | ||
|
||
use Doctrine\DBAL\Platforms\MySQLPlatform; | ||
use Doctrine\DBAL\Platforms\SQLServerPlatform; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20230130090946 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->skipIf(! $this->isMsSql(), 'This only sets MsSQL-specific database options'); | ||
|
||
$shortUrls = $schema->getTable('short_urls'); | ||
$shortCode = $shortUrls->getColumn('short_code'); | ||
// Drop the unique index before changing the collation, as the field is part of this index | ||
$shortUrls->dropIndex('unique_short_code_plus_domain'); | ||
$shortCode->setPlatformOption('collation', 'Latin1_General_CS_AS'); | ||
} | ||
|
||
public function postUp(Schema $schema): void | ||
{ | ||
if ($this->isMsSql()) { | ||
// The index needs to be re-created in postUp, but here, we can only use statements run against the | ||
// connection directly | ||
$this->connection->executeStatement( | ||
'CREATE INDEX unique_short_code_plus_domain ON short_urls (domain_id, short_code);', | ||
); | ||
} | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// No down | ||
} | ||
|
||
public function isTransactional(): bool | ||
{ | ||
return ! ($this->connection->getDatabasePlatform() instanceof MySQLPlatform); | ||
} | ||
|
||
private function isMsSql(): bool | ||
{ | ||
return $this->connection->getDatabasePlatform() instanceof SQLServerPlatform; | ||
} | ||
} |
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
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
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
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
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
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
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
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ShlinkioTest\Shlink\Core\ShortUrl\Model; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlMode; | ||
|
||
class ShortUrlModeTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* @dataProvider provideModes | ||
*/ | ||
public function deprecatedValuesAreProperlyParsed(string $mode, ?ShortUrlMode $expected): void | ||
{ | ||
self::assertSame($expected, ShortUrlMode::tryDeprecated($mode)); | ||
} | ||
|
||
public function provideModes(): iterable | ||
{ | ||
yield 'invalid' => ['invalid', null]; | ||
yield 'foo' => ['foo', null]; | ||
yield 'loose' => ['loose', ShortUrlMode::LOOSE]; | ||
yield 'loosely' => ['loosely', ShortUrlMode::LOOSE]; | ||
yield 'strict' => ['strict', ShortUrlMode::STRICT]; | ||
} | ||
} |