Ingen beskrivning

2016_05_09_145427_create_program_user_table.php 852B

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