From 4d5ff3f50ab7f4a8a4e64afacd88dc1f0c11bedf Mon Sep 17 00:00:00 2001 From: Kei Date: Thu, 16 Nov 2023 02:26:48 +0700 Subject: [PATCH] wip --- .../2018_08_03_114156_create_urls_table.php | 4 +++- tests/Unit/Models/UrlTest.php | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/database/migrations/2018_08_03_114156_create_urls_table.php b/database/migrations/2018_08_03_114156_create_urls_table.php index 70a82fb96..9865fcce4 100644 --- a/database/migrations/2018_08_03_114156_create_urls_table.php +++ b/database/migrations/2018_08_03_114156_create_urls_table.php @@ -17,7 +17,9 @@ public function up(): void ->nullable() ->constrained() ->cascadeOnDelete(); - $table->string('keyword')->unique(); + $table->string('keyword') + // ->collation('utf8mb4_bin') + ->unique(); $table->boolean('is_custom'); $table->longText('destination'); $table->string('title'); diff --git a/tests/Unit/Models/UrlTest.php b/tests/Unit/Models/UrlTest.php index ee6fa3e08..b8d5e93a5 100644 --- a/tests/Unit/Models/UrlTest.php +++ b/tests/Unit/Models/UrlTest.php @@ -327,4 +327,16 @@ public function totalClicks(): void $this->assertSame(1, $actual); } + + /** + * @group u-model + */ + public function testKeywordColumnIsCaseSensitive(): void + { + $url_1 = Url::factory(['keyword' => 'foo'])->create(); + $url_2 = Url::factory(['keyword' => 'Foo'])->create(); + + $this->assertSame('foo', $url_1->keyword); + $this->assertSame('Foo', $url_2->keyword); + } }