MySQL: Use bin format to compare oauth users
This commit is contained in:
parent
ea199f9485
commit
f0bddb321c
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Migrations;
|
||||
|
||||
use Engelsystem\Database\Migration\Migration;
|
||||
use Illuminate\Database\Query\Grammars\MySqlGrammar;
|
||||
|
||||
class OauthSetIdentifierBinary extends Migration
|
||||
{
|
||||
use Reference;
|
||||
|
||||
/**
|
||||
* Run the migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$connection = $this->schema->getConnection();
|
||||
if (!$connection->getQueryGrammar() instanceof MySqlGrammar) {
|
||||
return;
|
||||
}
|
||||
|
||||
$connection->unprepared(
|
||||
'
|
||||
ALTER TABLE `oauth`
|
||||
CHANGE `identifier`
|
||||
`identifier`
|
||||
VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
|
||||
NOT NULL
|
||||
'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$connection = $this->schema->getConnection();
|
||||
if (!$connection->getQueryGrammar() instanceof MySqlGrammar) {
|
||||
return;
|
||||
}
|
||||
|
||||
$connection->unprepared(
|
||||
'
|
||||
ALTER TABLE `oauth`
|
||||
CHANGE `identifier`
|
||||
`identifier`
|
||||
VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
|
||||
NOT NULL
|
||||
'
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Migrations;
|
||||
|
||||
use Engelsystem\Database\Migration\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class OauthChangeTokensToText extends Migration
|
||||
{
|
||||
use Reference;
|
||||
|
||||
/**
|
||||
* Run the migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->schema->table(
|
||||
'oauth',
|
||||
function (Blueprint $table) {
|
||||
$table->text('access_token')->change();
|
||||
$table->text('refresh_token')->change();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->schema->table(
|
||||
'oauth',
|
||||
function (Blueprint $table) {
|
||||
$table->string('access_token')->change();
|
||||
$table->string('refresh_token')->change();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -48,6 +48,7 @@ trait HasDatabase
|
|||
['migration' => '2019_09_07_000000_migrate_admin_schedule_permissions'],
|
||||
['migration' => '2020_04_07_000000_change_mysql_database_encoding_to_utf8mb4'],
|
||||
['migration' => '2020_09_12_000000_create_welcome_angel_permissions_group'],
|
||||
['migration' => '2020_12_28_000000_oauth_set_identifier_binary'],
|
||||
]
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue