我有一个case-insensitive
我的表中的排序规则列。
col_name : hash_id, collation : utf8mb4_unicode_ci
我得到的结果是yA2JeGs
and YA2JeGs
当我只搜索前者时。
所以我需要更新排序规则以确保case-sensitivity
对于该专栏。
我尝试更改该列的排序规则,创建一个新的migration
file:
public function up()
{
Schema::table('product_match_unmatches', function (Blueprint $table) {
$table->string('hash_id')->collate('utf8mb4_bin')->change();
});
}
还带有$table->string('hash_id')->collation('utf8mb4_bin')->change();
迁移成功运行,但排序规则保持不变。
我如何在 Laravel 中做到这一点?
您需要使用 laravel 架构生成器创建新的迁移并使列区分大小写,代码如下:
$table->string('columName')->collation('utf8_bin')->change();
https://laravel.com/docs/7.x/migrations https://laravel.com/docs/7.x/migrations
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)