diff --git a/db/migrations/2020_12_28_000000_oauth_set_identifier_binary.php b/db/migrations/2020_12_28_000000_oauth_set_identifier_binary.php new file mode 100644 index 00000000..9dab8d31 --- /dev/null +++ b/db/migrations/2020_12_28_000000_oauth_set_identifier_binary.php @@ -0,0 +1,53 @@ +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 + ' + ); + } +} diff --git a/db/migrations/2020_12_28_000001_oauth_change_tokens_to_text.php b/db/migrations/2020_12_28_000001_oauth_change_tokens_to_text.php new file mode 100644 index 00000000..e640d613 --- /dev/null +++ b/db/migrations/2020_12_28_000001_oauth_change_tokens_to_text.php @@ -0,0 +1,39 @@ +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(); + } + ); + } +} diff --git a/tests/Unit/HasDatabase.php b/tests/Unit/HasDatabase.php index 0be90bf6..584d6c23 100644 --- a/tests/Unit/HasDatabase.php +++ b/tests/Unit/HasDatabase.php @@ -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'], ] );