説明なし

2016_08_03_140525_add_unique_index_to_five_year_plans_table.php 614B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. class AddUniqueIndexToFiveYearPlansTable extends Migration {
  5. /**
  6. * Run the migrations.
  7. *
  8. * @return void
  9. */
  10. public function up()
  11. {
  12. Schema::table('five_year_plans', function(Blueprint $table)
  13. {
  14. $table->unique(array('quinquennium_id', 'program_id'));
  15. });
  16. }
  17. /**
  18. * Reverse the migrations.
  19. *
  20. * @return void
  21. */
  22. public function down()
  23. {
  24. Schema::table('five_year_plans', function(Blueprint $table)
  25. {
  26. $table->dropUnique('five_year_plans_quinquennium_id_program_id_unique');
  27. });
  28. }
  29. }