From 18e27144e745c162189609b20ba6542cbc933f9c Mon Sep 17 00:00:00 2001 From: Lukas Halbritter Date: Mon, 3 Sep 2018 15:24:07 +0200 Subject: [PATCH] Added person_target migration. --- app/PersonTarget.php | 10 ++++ ..._03_091643_create_person_targets_table.php | 54 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 app/PersonTarget.php create mode 100644 database/migrations/2018_09_03_091643_create_person_targets_table.php diff --git a/app/PersonTarget.php b/app/PersonTarget.php new file mode 100644 index 0000000..a844fdf --- /dev/null +++ b/app/PersonTarget.php @@ -0,0 +1,10 @@ +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'); + } +}