2021_12_15_120346_update_to_payments_table.php 945 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. use Illuminate\Support\Facades\DB;
  6. class UpdateToPaymentsTable 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. });
  20. DB::statement('UPDATE payments SET payment_method="paypal"');
  21. }
  22. /**
  23. * Reverse the migrations.
  24. *
  25. * @return void
  26. */
  27. public function down()
  28. {
  29. Schema::table('payments', function (Blueprint $table) {
  30. $table->dropColumn('payment_method');
  31. $table->string('payer_id')->nullable();
  32. $table->text('payer')->nullable();
  33. });
  34. }
  35. }