12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
-
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
-
- class CreateCriterionObjectiveOutcomeTable extends Migration
- {
-
- public function up()
- {
- Schema::create('criterion_objective_outcome', function (Blueprint $table) {
- $table->increments('id');
- $table->integer('criterion_id')->unsigned();
- $table->integer('objective_id')->unsigned();
- $table->integer('outcome_id')->unsigned();
- $table
- ->foreign('criterion_id')
- ->references('id')
- ->on('criteria')
- ->onDelete('cascade')
- ->onUpdate('cascade');
- /*$table
- ->foreign('objective_id')
- ->references('id')
- ->on('objectives')
- ->onDelete('cascade')
- ->onUpdate('cascade');
- $table
- ->foreign('outcome_id')
- ->references('id')
- ->on('outcomes')
- ->onDelete('cascade')
- ->onUpdate('cascade');*/
- $table->foreign(array('objective_id', 'outcome_id'))
- ->references(array('objective_id', 'outcome_id'))
- ->on('objective_outcome')
- ->onDelete('cascade')
- ->onUpdate('cascade');
- $table->timestamps();
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('criterion_objective_outcome');
- }
- }
|