remove ref counting, will be replaced by cleanup jobs or triggers

This commit is contained in:
2018-07-22 06:47:59 +02:00
parent e01c63cfa2
commit 9081b38425
7 changed files with 3 additions and 53 deletions
@@ -15,7 +15,6 @@ class CreateRowsTable extends Migration
{
Schema::create('rows', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('refs'); // used for reference counting
$table->jsonb('data');
});
}
@@ -16,7 +16,6 @@ class CreateRevisionsTable extends Migration
Schema::create('revisions', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->unsignedInteger('refs'); // used for reference counting
$table->unsignedInteger('ancestor_id')->index()->nullable(); // parent revision
// columns specification
@@ -27,17 +27,16 @@ class CreateProposalsTable extends Migration
$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')
->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
$table->foreign('table_id')->references('id')->on('tables')
->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')
->onDelete('restrict');
->onDelete('cascade');
});
}