Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
anje123 committed Sep 13, 2020
1 parent 0141632 commit 9a95867
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
33 changes: 33 additions & 0 deletions database/migrations/2020_03_16_214416_create_surveys_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSurveysTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('surveys', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->softDeletes();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('surveys');
}
}
39 changes: 39 additions & 0 deletions database/migrations/2020_03_16_214432_create_questions_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateQuestionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(
'questions', function (Blueprint $table) {
$table->increments('id');
$table->string('body');
$table->enum('kind', ['free-answer', 'yes-no', 'numeric']);
$table->integer('survey_id')->unsigned();
$table->softDeletes();
$table->timestamps();
$table->foreign('survey_id')->references('id')->on('surveys')->onDelete('cascade');

}
);
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('questions');
}
}

0 comments on commit 9a95867

Please sign in to comment.