pollthingy/database/migrations/2018_10_15_235354_create_po...

37 lines
763 B
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePollOptionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('poll_options', function (Blueprint $table) {
$table->increments('id');
$table->string('text');
$table->char('poll_id', 6);
$table->foreign('poll_id')->references('id')->on('polls');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$table->dropForeign(['poll_id']);
Schema::dropIfExists('poll_options');
}
}