Added member state migration and model.

This commit is contained in:
Lukas Halbritter
2018-09-07 10:41:16 +02:00
parent f62a100376
commit d00b21fa0d
2 changed files with 55 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class MemberState extends Model
{
//
}
@@ -0,0 +1,45 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMemberStatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('member_states', function (Blueprint $table) {
$table->increments('id');
// Ther person id the member dates belong to.
// IF the corresponding person is deleted, all the member dates are
// deleted, too.
$table->integer('person_id')->unsigned();
$table->foreign('person_id')->references('id')->on('people')
->onDelete('cascade');
// The date of joining
$table->date('joining_date');
// The date of leaving
$table->date('leaving_date')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('member_states');
}
}