暂无描述

2021_01_28_160558_ObjectiveProgramMigrate.php 857B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use Illuminate\Database\Schema\Blueprint;
  3. use Illuminate\Database\Migrations\Migration;
  4. class ObjectiveProgramMigrate extends Migration
  5. {
  6. /**
  7. * Run the migrations.
  8. *
  9. * @return void
  10. */
  11. public function up()
  12. {
  13. Schema::create('objective_program', function (Blueprint $table) {
  14. $table->increments('id');
  15. $table->integer('program_id')->unsigned();
  16. $table->integer('objective_id')->unsigned();
  17. $table
  18. ->foreign('objective_id')
  19. ->references('id')
  20. ->on('objectives')
  21. ->onDelete('cascade')
  22. ->onUpdate('cascade');
  23. $table
  24. ->foreign('program_id')
  25. ->references('id')
  26. ->on('programs')
  27. ->onDelete('cascade')
  28. ->onUpdate('cascade');
  29. $table->timestamps();
  30. });
  31. }
  32. /**
  33. * Reverse the migrations.
  34. *
  35. * @return void
  36. */
  37. public function down()
  38. {
  39. Schema::drop('objective_program');
  40. }
  41. }