Jelajahi Sumber

Update migrations

Daniel Supernault 3 tahun lalu
induk
melakukan
251e455c25

+ 6 - 4
database/migrations/2020_12_13_203646_add_providers_column_to_oauth_clients_table.php

@@ -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');
+	        });
+    	}
     }
 }

+ 32 - 0
database/migrations/2022_04_08_065311_create_cache_table.php

@@ -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');
+    }
+}