Added person_target migration.
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PersonTarget extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
@@ -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');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user