diff --git a/database/migrations/2020_03_16_214416_create_surveys_table.php b/database/migrations/2020_03_16_214416_create_surveys_table.php new file mode 100644 index 0000000..30aa0ef --- /dev/null +++ b/database/migrations/2020_03_16_214416_create_surveys_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->string('title'); + $table->softDeletes(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('surveys'); + } +} diff --git a/database/migrations/2020_03_16_214432_create_questions_table.php b/database/migrations/2020_03_16_214432_create_questions_table.php new file mode 100644 index 0000000..bef2b3c --- /dev/null +++ b/database/migrations/2020_03_16_214432_create_questions_table.php @@ -0,0 +1,39 @@ +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'); + } +}