remove ref counting, will be replaced by cleanup jobs or triggers
This commit is contained in:
@@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user