Set the foreign key person_targets->person_id from 'on delete restrict' to 'on

delete cascade', since it should be possible to delete a person which is even
and has paid all debts.

Before showing the delete confirmation dialog, it is checked, if there is any
open target.
This commit is contained in:
Lukas Halbritter
2018-09-25 15:20:19 +02:00
parent 1982ee0260
commit 494c5cf47c
@@ -20,7 +20,7 @@ class CreatePersonTargetsTable extends Migration
// target // target
$table->integer('person_id')->unsigned(); $table->integer('person_id')->unsigned();
$table->foreign('person_id')->references('id')->on('people') $table->foreign('person_id')->references('id')->on('people')
->onDelete('restrict'); ->onDelete('cascade');
// The date on which the debt arises // The date on which the debt arises
$table->date('date'); $table->date('date');