add models and relations

This commit is contained in:
2018-07-12 21:56:07 +02:00
parent ce88fd3978
commit 34df868d57
11 changed files with 230 additions and 19 deletions
@@ -27,7 +27,7 @@ class CreateDataTablesTable extends Migration
$table->foreign('owner_id')->references('id')->on('users')
->onDelete('cascade');
$table->foreign('precursor_id')->references('id')->on('data_tables')
$table->foreign('parent_table_id')->references('id')->on('data_tables')
->onDelete('set null');
});
}
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommentsTable extends Migration
class CreateTableCommentsTable extends Migration
{
/**
* Run the migrations.
@@ -13,7 +13,7 @@ class CreateCommentsTable extends Migration
*/
public function up()
{
Schema::create('comments', function (Blueprint $table) {
Schema::create('table_comments', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->unsignedInteger('ancestor_id')->index()->nullable();
@@ -39,6 +39,6 @@ class CreateCommentsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('comments');
Schema::dropIfExists('table_comments');
}
}
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFavouritesTable extends Migration
class CreateTableFavouritesTable extends Migration
{
/**
* Run the migrations.
@@ -13,7 +13,7 @@ class CreateFavouritesTable extends Migration
*/
public function up()
{
Schema::create('favourites', function (Blueprint $table) {
Schema::create('table_favourites', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
@@ -35,6 +35,6 @@ class CreateFavouritesTable extends Migration
*/
public function down()
{
Schema::dropIfExists('favourites');
Schema::dropIfExists('table_favourites');
}
}
@@ -16,6 +16,7 @@ class CreateNotificationsTable extends Migration
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->boolean('seen');
$table->unsignedInteger('user_id')->index();
$table->unsignedInteger('actor_id')->index()->nullable(); // who did it
$table->string('action'); // what happened, e.g.: favourited, mentioned, forked, commented