MySQL: Use bin format to compare oauth users
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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue