|
|
@ -27,17 +27,16 @@ class CreateProposalsTable extends Migration |
|
|
|
|
|
|
|
|
|
|
|
$table->jsonb('changes'); // the actual meat of the changeset is stored here |
|
|
|
$table->jsonb('changes'); // the actual meat of the changeset is stored here |
|
|
|
|
|
|
|
|
|
|
|
// block the delete - we must first decrement Row refs and then the proposals manually |
|
|
|
|
|
|
|
$table->foreign('revision_id')->references('id')->on('revisions') |
|
|
|
$table->foreign('revision_id')->references('id')->on('revisions') |
|
|
|
->onDelete('restrict'); |
|
|
|
->onDelete('cascade'); // a proposal without the revision is useless |
|
|
|
|
|
|
|
|
|
|
|
// deleting the table must NOT delete the proposals, as they may be applicable to forks sharing the revision |
|
|
|
// deleting the table must NOT delete the proposals, as they may be applicable to forks sharing the revision |
|
|
|
$table->foreign('table_id')->references('id')->on('tables') |
|
|
|
$table->foreign('table_id')->references('id')->on('tables') |
|
|
|
->onDelete('set null'); |
|
|
|
->onDelete('set null'); |
|
|
|
|
|
|
|
|
|
|
|
// block the delete - we must first decrement Row refs and then the proposals manually |
|
|
|
// deleting author wipes their proposals |
|
|
|
$table->foreign('author_id')->references('id')->on('users') |
|
|
|
$table->foreign('author_id')->references('id')->on('users') |
|
|
|
->onDelete('restrict'); |
|
|
|
->onDelete('cascade'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|