Browse Source

fix: 🐛 payments migration

IceToast 3 years ago
parent
commit
bd56c6b320

+ 7 - 4
database/migrations/2021_12_15_120346_update_to_payment_table.php → database/migrations/2021_12_15_120346_update_to_payments_table.php

@@ -3,8 +3,10 @@
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Support\Facades\Schema;
 use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
 
 
-class UpdateToPaymentTable extends Migration
+
+class UpdateToPaymentsTable extends Migration
 {
 {
     /**
     /**
      * Run the migrations.
      * Run the migrations.
@@ -13,11 +15,13 @@ class UpdateToPaymentTable extends Migration
      */
      */
     public function up()
     public function up()
     {
     {
-        Schema::table('payment', function (Blueprint $table) {
+        Schema::table('payments', function (Blueprint $table) {
             $table->string('payment_method');
             $table->string('payment_method');
             $table->dropColumn('payer');
             $table->dropColumn('payer');
             $table->dropColumn('payer_id');
             $table->dropColumn('payer_id');
         });
         });
+
+        DB::statement('UPDATE payments SET payment_method="paypal"');
     }
     }
 
 
     /**
     /**
@@ -27,10 +31,9 @@ class UpdateToPaymentTable extends Migration
      */
      */
     public function down()
     public function down()
     {
     {
-        Schema::table('payment', function (Blueprint $table) {
+        Schema::table('payments', function (Blueprint $table) {
             $table->dropColumn('payment_method');
             $table->dropColumn('payment_method');
             $table->string('payer_id')->nullable();
             $table->string('payer_id')->nullable();
-            $table->string('payer_id')->nullable();
             $table->text('payer')->nullable();
             $table->text('payer')->nullable();
         });
         });
     }
     }