Bez popisu

2015_01_13_142849_add_column_to_criteria_table.php 641B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. class AddColumnToCriteriaTable extends Migration {
  5. /**
  6. * Run the migrations.
  7. *
  8. * @return void
  9. */
  10. public function up()
  11. {
  12. Schema::table('criteria', function(Blueprint $table)
  13. {
  14. $table->integer('user_id')->unsigned()->nullable();
  15. $table->foreign('user_id')->references('id')->on('users');
  16. });
  17. }
  18. /**
  19. * Reverse the migrations.
  20. *
  21. * @return void
  22. */
  23. public function down()
  24. {
  25. Schema::table('criteria', function(Blueprint $table)
  26. {
  27. $table->dropColumn('user_id');
  28. $table->dropForeign('user_id');
  29. });
  30. }
  31. }