dienstplan/database/migrations/2017_06_10_115618_create_arbeitsplatzs_table.php
2017-06-10 14:14:53 +02:00

45 lines
1.1 KiB
PHP

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