updated models

This commit is contained in:
2018-07-14 12:24:24 +02:00
parent c75b25b89b
commit 6fd1d7eb89
16 changed files with 225 additions and 129 deletions
@@ -17,7 +17,6 @@ class CreateRevisionsTable extends Migration
$table->increments('id');
$table->timestamps();
$table->unsignedInteger('refs'); // used for reference counting
$table->unsignedInteger('author_id')->index();
$table->unsignedInteger('ancestor_id')->index()->nullable(); // parent revision
// a column that can be used as the primary key for a table; possibly a composite column if using a comma
@@ -26,9 +25,6 @@ class CreateRevisionsTable extends Migration
// author's note describing what has been changed
$table->text('note');
$table->foreign('author_id')->references('id')->on('users')
->onDelete('set null');
$table->foreign('ancestor_id')->references('id')->on('revisions')
->onDelete('set null');
});
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProposalDeleteRowPivotTable extends Migration
class CreateProposalRemoveRowPivotTable extends Migration
{
/**
* Run the migrations.
@@ -13,7 +13,7 @@ class CreateProposalDeleteRowPivotTable extends Migration
*/
public function up()
{
Schema::create('proposal_delete_row_pivot', function (Blueprint $table) {
Schema::create('proposal_remove_row_pivot', function (Blueprint $table) {
$table->unsignedInteger('proposal_id')->index();
$table->unsignedInteger('row_id')->index();
@@ -32,6 +32,6 @@ class CreateProposalDeleteRowPivotTable extends Migration
*/
public function down()
{
Schema::dropIfExists('proposal_delete_row_pivot');
Schema::dropIfExists('proposal_remove_row_pivot');
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRevisionProposalPivotTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('revision_proposal_pivot', function (Blueprint $table) {
$table->unsignedInteger('proposal_id')->index();
$table->unsignedInteger('revision_id')->index();
$table->foreign('proposal_id')->references('id')->on('proposals')
->onDelete('cascade');
$table->foreign('revision_id')->references('id')->on('revisions')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('revision_proposal_pivot');
}
}
@@ -14,11 +14,8 @@ class CreateTableFavouritesTable extends Migration
public function up()
{
Schema::create('table_favourites', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->unsignedInteger('user_id');
$table->unsignedInteger('table_id');
$table->unsignedInteger('user_id')->index();
$table->unsignedInteger('table_id')->index();
$table->foreign('user_id')->references('id')->on('users')
->onDelete('cascade');
@@ -14,10 +14,8 @@ class CreateDiscussionFollowsTable extends Migration
public function up()
{
Schema::create('discussion_follows', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->unsignedInteger('user_id');
$table->unsignedInteger('table_id');
$table->unsignedInteger('user_id')->index();
$table->unsignedInteger('table_id')->index();
$table->foreign('user_id')->references('id')->on('users')
->onDelete('cascade');