MYSQL case insensitive by default:
to get case sensitive record:
SELECT * FROM `hash_table` WHERE BINARY `hash` = BINARY "abc"
https://stackoverflow.com/questions/40183293/mysql-select-by-difference-between-lowercase-and-uppercase-characters
Laravel:
Invite::whereRaw("BINARY `token`= ?",[$token])->first()
https://stackoverflow.com/questions/25494849/case-sensitive-where-statement-in-laravel
But this will still prevent writting to the column, if column has unique key constraint . Arecord is considered same as arecord
so
ALTER TABLE temp CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
In laravel:
create migration
public function up()
{
// Need utf
DB::statement("ALTER TABLE <mytable> CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin");
}
https://stackoverflow.com/questions/46587931/changing-the-collation-of-database-column-is-not-working-in-laravel-migrations
MYSQL default is case insesntive
it is $table->charset('utf8mb4');
$table->collate('utf8mb4_unicode_ci');
https://github.com/laravel/framework/issues/8857
No comments:
Post a Comment