Added person_target migration.

This commit is contained in:
Lukas Halbritter
2018-09-03 15:24:07 +02:00
parent 286fea3c1d
commit 18e27144e7
2 changed files with 64 additions and 0 deletions
@@ -0,0 +1,54 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePersonTargetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('person_targets', function (Blueprint $table) {
$table->increments('id');
// Person reference to the person which has to pay/receive the
// target
$table->integer('person_id')->unsigned();
$table->foreign('person_id')->references('id')->on('people')
->onDelete('restrict');
// The date on which the debt arises
$table->date('date');
// The amount of the debt
$table->float('amount', 8, 2);
// The type of the target. It can be either a payable or a
// receivable. A payable is of type 'expediture' and a receivable is
// of type 'income'.
$table->integer('io_type')->unsigned();
$table->foreign('io_type')->references('id')->on('io_types')
->onDelete('no action');
// A reference text which describes the target
$table->string('reference');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('person_targets');
}
}