Ei kuvausta

2014_11_10_035949_create_rubrics_table.php 815B

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