2021_12_15_120346_update_to_payments_table.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\DB;
  5. use Illuminate\Support\Facades\Schema;
  6. return new class extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::table('payments', function (Blueprint $table) {
  16. $table->string('payment_method');
  17. $table->dropColumn('payer');
  18. $table->dropColumn('payer_id');
  19. $table->string('credit_product_id');
  20. });
  21. DB::statement('UPDATE payments SET payment_method="paypal"');
  22. }
  23. /**
  24. * Reverse the migrations.
  25. *
  26. * @return void
  27. */
  28. public function down()
  29. {
  30. Schema::table('payments', function (Blueprint $table) {
  31. $table->dropColumn('payment_method');
  32. $table->string('payer_id')->nullable();
  33. $table->text('payer')->nullable();
  34. $table->dropColumn('credit_product_id');
  35. });
  36. }
  37. };