Nav apraksta

2016_07_15_090133_create_fyp_parts_table.php 870B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. class CreateFypPartsTable extends Migration {
  5. /**
  6. * Run the migrations.
  7. *
  8. * @return void
  9. */
  10. public function up()
  11. {
  12. Schema::create('fyp_parts', function(Blueprint $table)
  13. {
  14. $table->engine = 'InnoDB';
  15. $table->increments('id');
  16. $table->integer('five_year_plan_id')->unsigned();
  17. $table
  18. ->foreign('five_year_plan_id')
  19. ->references('id')
  20. ->on('five_year_plans')
  21. ->onDelete('cascade')
  22. ->onUpdate('cascade');
  23. $table->char('year_start', 4);
  24. $table->char('year_end', 4);
  25. $table->timestamps();
  26. });
  27. DB::statement("ALTER TABLE `fyp_parts` comment 'Annual plans that are part of a five-year plan'");
  28. }
  29. /**
  30. * Reverse the migrations.
  31. *
  32. * @return void
  33. */
  34. public function down()
  35. {
  36. Schema::drop('fyp_parts');
  37. }
  38. }