dienstplan/database/migrations/2017_07_08_100720_AddOrtTable.php
2017-07-08 10:26:50 +02:00

47 lines
973 B
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddOrtTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('orte', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('name',50);
});
Schema::table('veranstaltungen', function (Blueprint $table) {
$table->integer('ort_id')->unsigned()->nullable();
$table->foreign('ort_id')->references('id')->on('orte');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('veranstaltungen', function (Blueprint $table) {
$table->dropColumn('ort_id');
});
Schema::dropIfExists('orte');
}
}