Update migrations

This commit is contained in:
Daniel Supernault 2022-04-08 01:51:01 -06:00
parent a3d76ee522
commit 251e455c25
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
2 changed files with 38 additions and 4 deletions

View File

@ -14,7 +14,7 @@ class AddProvidersColumnToOauthClientsTable extends Migration
public function up()
{
Schema::table('oauth_clients', function (Blueprint $table) {
if(Schema::hasColumn('oauth_clients', 'provider') == false) {
if(Schema::hasTable('oauth_clients') && Schema::hasColumn('oauth_clients', 'provider') == false) {
$table->string('provider')->after('secret')->nullable();
}
});
@ -27,8 +27,10 @@ class AddProvidersColumnToOauthClientsTable extends Migration
*/
public function down()
{
Schema::table('oauth_clients', function (Blueprint $table) {
$table->dropColumn('provider');
});
if(Schema::hasTable('oauth_clients')) {
Schema::table('oauth_clients', function (Blueprint $table) {
$table->dropColumn('provider');
});
}
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCacheTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cache');
}
}