2020_12_07_114158_create_station_task_children.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateStationTaskChildren extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('station_task_children', function (Blueprint $table) {
  15. $table->id();
  16. $table->bigInteger('station_task_id')->index();
  17. $table->string('station_task_table_type');
  18. $table->bigInteger('station_task_table_id');
  19. $table->index('station_task_table_id','station_task_table_type');
  20. $table->timestamps();
  21. });
  22. Schema::table('station_task_batches', function (Blueprint $table) {
  23. $table->dropColumn('station_id');
  24. });
  25. Schema::table('station_task_commodities', function (Blueprint $table) {
  26. $table->dropColumn('station_id');
  27. });
  28. Schema::table('station_task_material_boxes', function (Blueprint $table) {
  29. $table->dropColumn('station_id');
  30. });
  31. }
  32. /**
  33. * Reverse the migrations.
  34. *
  35. * @return void
  36. */
  37. public function down()
  38. {
  39. Schema::table('station_task_batches', function (Blueprint $table) {
  40. $table->integer('station_id')->index();
  41. });
  42. Schema::table('station_task_commodities', function (Blueprint $table) {
  43. $table->integer('station_id')->index();
  44. });
  45. Schema::table('station_task_material_boxes', function (Blueprint $table) {
  46. $table->integer('station_id')->index();
  47. });
  48. Schema::dropIfExists('station_task_children');
  49. }
  50. }