Browse Source

Fix #1042 Change the column collation on MySQL to utf8mb4_bin

pull/1185/head
Timothée Jaussoin 3 years ago
parent
commit
84e111e464
  1. 4
      database/migrations/20201128214540_add_index_parentmid_to_messages_table.php
  2. 3
      database/migrations/20210118230910_remove_jid_foreign_from_members_table.php
  3. 4
      database/migrations/20210922194637_add_bundle_id_deviceid_unique_to_bundle_sessions_table.php
  4. 22
      database/migrations/20230318150507_set_correct_collation_emoji_to_reactions_table.php

4
database/migrations/20201128214540_add_index_parentmid_to_messages_table.php

@ -14,8 +14,12 @@ class AddIndexParentmidToMessagesTable extends Migration
public function down()
{
$this->disableForeignKeyCheck();
$this->schema->table('messages', function (Blueprint $table) {
$table->dropIndex('messages_parentmid_index');
});
$this->enableForeignKeyCheck();
}
}

3
database/migrations/20210118230910_remove_jid_foreign_from_members_table.php

@ -15,10 +15,13 @@ class RemoveJidForeignFromMembersTable extends Migration
public function down()
{
$this->disableForeignKeyCheck();
$this->schema->table('members', function (Blueprint $table) {
$table->foreign('jid')
->references('id')->on('contacts');
});
$this->enableForeignKeyCheck();
}
}

4
database/migrations/20210922194637_add_bundle_id_deviceid_unique_to_bundle_sessions_table.php

@ -19,9 +19,13 @@ class AddBundleIdDeviceIdUniqueToBundleSessionsTable extends Migration
public function down()
{
$this->disableForeignKeyCheck();
$this->schema->table('bundle_sessions', function (Blueprint $table) {
$table->dropUnique('bundle_sessions_bundle_id_deviceid_unique');
$table->renameColumn('deviceid', 'device_id');
});
$this->enableForeignKeyCheck();
}
}

22
database/migrations/20230318150507_set_correct_collation_emoji_to_reactions_table.php

@ -0,0 +1,22 @@
<?php
use Movim\Migration;
class SetCorrectCollationEmojiToReactionsTable extends Migration
{
public function up()
{
/**
* MySQL specific fix to ensure that the emojis are properly handled
* See https://github.com/movim/movim/issues/1042
*/
if ($this->schema->getConnection()->getDriverName() == 'mysql') {
$this->schema->getConnection()->unprepared('alter table reactions modify emoji varchar(32) charset utf8mb4 collate utf8mb4_bin;');
}
}
public function down()
{
}
}
Loading…
Cancel
Save