fix: 🐛 payments migration

This commit is contained in:
IceToast 2021-12-15 13:30:32 +01:00
parent ae47ebfcc6
commit bd56c6b320

View file

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