added models

This commit is contained in:
chrosey
2017-06-10 14:14:53 +02:00
parent ebb2728c18
commit 609231b044
11 changed files with 274 additions and 0 deletions
@@ -0,0 +1,28 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBenutzersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::rename("users", "benutzer");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::rename('benutzer',"users");
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateVeranstaltungsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('veranstaltungen', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->dateTime('beginn');
$table->string('name',200);
$table->integer('gaeste')->unsigned();
$table->string('hinweise',2000);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('veranstaltungen');
}
}
@@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEintragungsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('eintragungen', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('benutzer_id')->unsigned();
$table->foreign('benutzer_id')->references('id')->on('benutzer');
$table->integer('veranstaltung_id')->unsigned();
$table->foreign('veranstaltung_id')->references('id')->on('veranstaltungen');
$table->boolean('nicht_unbedingt')->default(false);
$table->dateTime('kann_ab')->nullable();
$table->dateTime('kann_bis')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('eintragungen');
}
}
@@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEinteilungsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('einteilungen', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->dateTime('start');
$table->dateTime('ende')->nullable();
$table->integer('benutzer_id')->unsigned();
$table->foreign('benutzer_id')->references('id')->on('benutzer');
$table->integer('veranstaltung_id')->unsigned();
$table->foreign('veranstaltung_id')->references('id')->on('veranstaltungen');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('einteilungen');
}
}
@@ -0,0 +1,44 @@
<?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');
}
}