Add migrations
This commit is contained in:
parent
9325f6b609
commit
c1799af6bc
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('comment_replies', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('comment_id')->index();
|
||||
$table->unsignedBigInteger('video_id')->index();
|
||||
$table->unsignedBigInteger('profile_id');
|
||||
$table->text('caption')->nullable();
|
||||
$table->json('entities')->nullable();
|
||||
$table->unsignedInteger('likes')->default(0);
|
||||
$table->boolean('is_edited')->default(false);
|
||||
$table->boolean('is_hidden')->default(false);
|
||||
$table->boolean('is_sensitive')->default(false);
|
||||
$table->foreign('video_id')->references('id')->on('videos')->cascadeOnDelete();
|
||||
$table->foreign('profile_id')->references('id')->on('profiles')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('comment_replies');
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('followers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('profile_id')->index();
|
||||
$table->unsignedBigInteger('following_id');
|
||||
$table->boolean('following_is_local')->default(true)->index();
|
||||
$table->foreign('profile_id')->references('id')->on('profiles')->cascadeOnDelete();
|
||||
$table->foreign('following_id')->references('id')->on('profiles')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('followers');
|
||||
}
|
||||
};
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedTinyInteger('type')->index();
|
||||
$table->unsignedBigInteger('user_id')->index();
|
||||
$table->unsignedBigInteger('profile_id')->nullable();
|
||||
$table->unsignedBigInteger('video_id')->nullable();
|
||||
$table->unsignedBigInteger('comment_id')->nullable();
|
||||
$table->unsignedBigInteger('comment_reply_id')->nullable();
|
||||
$table->json('meta')->nullable();
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->foreign('profile_id')->references('id')->on('profiles')->cascadeOnDelete();
|
||||
$table->foreign('video_id')->references('id')->on('videos')->cascadeOnDelete();
|
||||
$table->foreign('comment_id')->references('id')->on('comments')->cascadeOnDelete();
|
||||
$table->foreign('comment_reply_id')->references('id')->on('comment_replies')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('video_likes', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('profile_id');
|
||||
$table->unsignedBigInteger('video_id');
|
||||
$table->unique(['profile_id', 'video_id']);
|
||||
$table->foreign('video_id')->references('id')->on('videos')->cascadeOnDelete();
|
||||
$table->foreign('profile_id')->references('id')->on('profiles')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('video_likes');
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('comment_likes', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('profile_id');
|
||||
$table->unsignedBigInteger('comment_id');
|
||||
$table->unique(['profile_id', 'comment_id']);
|
||||
$table->foreign('profile_id')->references('id')->on('profiles')->cascadeOnDelete();
|
||||
$table->foreign('comment_id')->references('id')->on('comments')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('comment_likes');
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('comment_reply_likes', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('profile_id');
|
||||
$table->unsignedBigInteger('comment_id');
|
||||
$table->unique(['profile_id', 'comment_id']);
|
||||
$table->foreign('profile_id')->references('id')->on('profiles')->cascadeOnDelete();
|
||||
$table->foreign('comment_id')->references('id')->on('comment_reply_likes')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('comment_reply_likes');
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('push_token')->nullable();
|
||||
$table->json('device')->nullable();
|
||||
$table->timestamp('push_token_verified_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('push_token');
|
||||
$table->dropColumn('device');
|
||||
$table->dropColumn('push_token_verified_at');
|
||||
});
|
||||
}
|
||||
};
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_legacy_passwords', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id')->unique()->index();
|
||||
$table->json('passwords')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_legacy_passwords');
|
||||
}
|
||||
};
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sounds', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('video_id');
|
||||
$table->string('sha512_hash')->nullable();
|
||||
$table->boolean('can_reshare')->default(true);
|
||||
$table->string('storage_path')->nullable();
|
||||
$table->unsignedTinyInteger('version')->default(1);
|
||||
$table->foreign('video_id')->references('id')->on('videos')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sounds');
|
||||
}
|
||||
};
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('topics', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('slug')->unique()->index();
|
||||
$table->unsignedBigInteger('total_count')->default(0)->index();
|
||||
$table->text('admin_notes')->nullable();
|
||||
$table->text('public_description')->nullable();
|
||||
$table->unsignedTinyInteger('topic_rank')->default(50)->index();
|
||||
$table->json('subtopics')->nullable();
|
||||
$table->json('related_topics')->nullable();
|
||||
$table->string('icon')->nullable();
|
||||
$table->string('icon_url')->nullable();
|
||||
$table->boolean('is_active')->default(false)->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('topics');
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('video_topics', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('video_id');
|
||||
$table->json('topics')->nullable();
|
||||
$table->json('subtopics')->nullable();
|
||||
$table->json('content_filters')->nullable();
|
||||
$table->foreign('video_id')->references('id')->on('videos')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('video_topics');
|
||||
}
|
||||
};
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('videos', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('profile_id')->nullable()->index();
|
||||
$table->string('vid')->nullable();
|
||||
$table->text('vid_optimized')->nullable();
|
||||
$table->unsignedTinyInteger('status')->default(1)->index();
|
||||
$table->unsignedTinyInteger('duration')->nullable();
|
||||
$table->unsignedInteger('size_kb')->nullable();
|
||||
$table->text('caption')->nullable();
|
||||
$table->string('category', 50)->nullable();
|
||||
$table->json('tags')->nullable();
|
||||
$table->unsignedInteger('likes')->default(0);
|
||||
$table->unsignedInteger('comments')->default(0);
|
||||
$table->unsignedInteger('shares')->default(0);
|
||||
$table->unsignedInteger('views')->default(0);
|
||||
$table->boolean('is_sensitive')->default(false);
|
||||
$table->boolean('is_adult')->default(false);
|
||||
$table->boolean('has_audio')->default(true);
|
||||
$table->boolean('has_thumb')->default(false);
|
||||
$table->boolean('has_processed')->default(false);
|
||||
$table->boolean('is_approved')->default(false)->index();
|
||||
$table->json('features')->nullable();
|
||||
$table->json('media_metadata')->nullable();
|
||||
$table->unsignedTinyInteger('comment_state')->default(4);
|
||||
$table->string('cw_title')->nullable();
|
||||
$table->text('cw_body')->nullable();
|
||||
$table->string('sha512_hash')->nullable()->index();
|
||||
$table->boolean('has_hls')->default(false);
|
||||
$table->boolean('can_download')->default(false);
|
||||
$table->boolean('can_duet')->default(false);
|
||||
$table->boolean('can_stitch')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('videos');
|
||||
}
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('hashtags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 191)->unique();
|
||||
$table->string('name_normalized', 191)->unique();
|
||||
$table->boolean('can_trend')->default(false)->index();
|
||||
$table->boolean('can_search')->default(true);
|
||||
$table->boolean('can_autolink')->default(true);
|
||||
$table->boolean('is_nsfw')->default(false);
|
||||
$table->boolean('is_banned')->default(false);
|
||||
$table->unsignedBigInteger('count')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('hashtags');
|
||||
}
|
||||
};
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('video_hashtags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('video_id')->constrained()->onDelete('cascade');
|
||||
$table->foreignId('hashtag_id')->constrained()->onDelete('cascade');
|
||||
$table->unique(['video_id', 'hashtag_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('video_hashtags');
|
||||
}
|
||||
};
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user