mirror of https://github.com/pixelfed/pixelfed
Change the collation for the hashtags table
Changes the collation for the hashtags table to utf8mb4_unicode_520_ci when the driver is MySQL or MariaDB. Otherwise the default collation of utf8mb4_unicode_ci is used which conflates all characters outside of the basic multilingual plane. This meant that any hashtag that is using a script not in the BMP ends up matching with any other hashtag with a script outside the BMP if it has the same length.pull/6098/head
parent
94367189ea
commit
53e5692cfb
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
if (config('database.default') === 'pgsql')
|
||||||
|
return;
|
||||||
|
|
||||||
|
Schema::table('hashtags', function (Blueprint $table) {
|
||||||
|
$table->string('name')->collation('utf8mb4_unicode_520_ci')->change();
|
||||||
|
$table->string('slug')->collation('utf8mb4_unicode_520_ci')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
if (config('database.default') === 'pgsql')
|
||||||
|
return;
|
||||||
|
|
||||||
|
Schema::table('hashtags', function (Blueprint $table) {
|
||||||
|
$table->string('name')->change();
|
||||||
|
$table->string('slug')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue