This commit is contained in:
2025-02-16 21:11:07 +02:00
parent 87bbfc33d3
commit e8d7e6a1c4
253 changed files with 3879 additions and 72 deletions
@@ -15,14 +15,14 @@ return new class extends Migration
$table->id();
$table->integer('entity_id');
$table->string('entity_type');
$table->integer('user_id')->nullable(true);
$table->string('author_name');
$table->integer('user_id')->nullable();
$table->string('author_name')->nullable();
$table->string('author_avatar')->nullable();
$table->integer('author_rating')->nullable();
$table->text('content');
$table->datetime('published_at');
$table->string('tmdb_id');
$table->string('tmdb_url');
$table->string('tmdb_id')->nullable();
$table->string('tmdb_url')->nullable();
$table->timestamps();
});
}
@@ -19,6 +19,10 @@ return new class extends Migration
$table->unsignedBigInteger('category_id');
$table->unsignedBigInteger('thread_id');
$table->unsignedBigInteger('user_id');
$table->unsignedInteger('views_no');
$table->unsignedInteger('replies_no');
$table->timestamps();
});
}
@@ -13,6 +13,9 @@ return new class extends Migration
{
Schema::create('forum_posts', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('topic_id');
$table->unsignedBigInteger('thread_id');
$table->unsignedBigInteger('category_id');
$table->text('content');
$table->unsignedBigInteger('user_id');
$table->timestamps();
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAcquaintancesFriendshipTable extends Migration
{
public function up()
{
Schema::create(config('acquaintances.tables.friendships'), function (Blueprint $table) {
$table->id();
$table->morphs('sender');
$table->morphs('recipient');
$table->string('status')->default('pending')->comment('pending/accepted/denied/blocked/');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists(config('acquaintances.tables.friendships'));
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateFriendshipsGroupsTable
*/
class CreateAcquaintancesFriendshipsGroupsTable extends Migration
{
public function up()
{
Schema::create(config('acquaintances.tables.friendship_groups'), function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('friendship_id')->unsigned();
$table->morphs('friend');
$table->integer('group_id')->unsigned();
$table->foreign('friendship_id')
->references('id')
->on(config('acquaintances.tables.friendships'))
->onDelete('cascade');
$table->unique(['friendship_id', 'friend_id', 'friend_type', 'group_id'], 'unique');
});
}
public function down()
{
Schema::dropIfExists(config('acquaintances.tables.friendship_groups'));
}
}
@@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Multicaret\Acquaintances\Interaction;
class CreateAcquaintancesInteractionsTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create(config('acquaintances.tables.interactions', 'interactions'), function (Blueprint $table) {
$table->id();
$userModel = Interaction::getUserModelName();
$userModel = (new $userModel);
$userIdFkColumnName = config('acquaintances.tables.interactions_user_id_fk_column_name', 'user_id');
$userIdFkType = config('acquaintances.tables.interactions_user_id_fk_column_type');
$table->{$userIdFkType}($userIdFkColumnName)->index();
$table->morphs('subject');
$table->string('relation')->default('follow')->comment('follow/like/subscribe/favorite/upvote/downvote');
$table->double('relation_value')->nullable();
$table->string('relation_type')->nullable();
$table->timestamps();
$table->foreign($userIdFkColumnName)
->references($userModel->getKeyName())
->on($userModel->getTable())
->onUpdate('cascade')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::table(config('acquaintances.tables.interactions', 'interactions'), function ($table) {
$table->dropForeign(config('acquaintances.tables.interactions', 'interactions').'_user_id_foreign');
});
Schema::drop(config('acquaintances.tables.interactions', 'interactions'));
}
}