2021_05_07_065911_update_to_servers_table.php 1002 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::table('servers', function (Blueprint $table) {
  15. $table->dropForeign('servers_egg_id_foreign');
  16. $table->dropForeign('servers_location_id_foreign');
  17. $table->dropColumn('egg_id');
  18. $table->dropColumn('location_id');
  19. $table->string('config')->nullable();
  20. });
  21. }
  22. /**
  23. * Reverse the migrations.
  24. *
  25. * @return void
  26. */
  27. public function down()
  28. {
  29. Schema::table('servers', function (Blueprint $table) {
  30. $table->foreignId('egg_id')->references('id')->on('eggs');
  31. $table->foreignId('location_id')->references('id')->on('locations');
  32. $table->dropColumn('config');
  33. });
  34. }
  35. };