Skip to content

Commit

Permalink
Only add the "utf8mb4_bin" collation if using MySQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
ash-jc-allen committed Mar 11, 2024
1 parent 03f5751 commit f9f3b5d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ public function up()
Schema::connection(config('short-url.connection'))->create('short_urls', function (Blueprint $table) {
$table->bigIncrements('id');
$table->text('destination_url');
$table->string('url_key')->unique()->collation('utf8mb4_bin');

$table->string('url_key')->unique()->when(
Schema::getConnection()->getConfig('driver') === 'mysql',
function (Blueprint $column) {
$column->collation('utf8mb4_bin');
}
);

$table->string('default_short_url');
$table->boolean('single_use');
$table->boolean('track_visits');
Expand Down

0 comments on commit f9f3b5d

Please sign in to comment.