This commit is contained in:
ct
2025-06-08 04:39:38 +08:00
parent 862a6bb19e
commit 8d6e86ebb3
40 changed files with 838 additions and 1601 deletions

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('CREATE EXTENSION IF NOT EXISTS vector');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement('DROP EXTENSION vector');
}
};

View File

@@ -1,41 +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->id();
$table->softDeletes();
$table->uuid('uuid');
$table->foreignId('user_id')->nullable();
$table->string('external_id')->nullable();
$table->string('content_type')->default('blank')->index();
$table->integer('width');
$table->integer('height');
$table->enum('aspect_ratio', ['16:9', '9:16', '1:1', '4:3', '3:4'])->default('9:16');
$table->json('payload');
$table->json('render_settings');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('videos');
}
};

View File

@@ -1,46 +0,0 @@
<?php
use App\Helpers\FirstParty\Render\RenderConstants;
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_renders', function (Blueprint $table) {
$table->id();
$table->softDeletes();
$table->uuid('uuid');
$table->string('external_id')->nullable();
$table->foreignId('video_id')->nullable();
$table->foreignId('user_id')->nullable();
$table->json('payload');
$table->enum('status', RenderConstants::STATUSES)->default(RenderConstants::STATUS_PLANNED);
$table->datetime('processing_started_at')->nullable();
$table->datetime('processing_finished_at')->nullable();
$table->uuid('completed_video_uuid')->nullable();
$table->string('completed_video_full_url')->nullable();
$table->timestamps();
$table->foreign('video_id')->references('id')->on('videos');
$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('video_renders');
}
};

View File

@@ -1,38 +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('video_captions', function (Blueprint $table) {
$table->id();
$table->softDeletes();
$table->foreignId('video_id');
$table->double('time');
$table->double('duration');
$table->text('text');
$table->json('parameters');
$table->json('words');
$table->timestamps();
$table->foreign('video_id')->references('id')->on('videos');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('video_captions');
}
};

View File

@@ -1,46 +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('video_elements', function (Blueprint $table) {
$table->id();
$table->softDeletes();
$table->foreignId('video_id');
$table->string('external_reference')->nullable();
$table->string('asset_hash', 64);
$table->string('original_asset_url')->nullable();
$table->uuid('asset_uuid')->nullable();
$table->string('asset_url')->nullable();
$table->enum('type', ['video', 'image', 'audio']);
$table->double('time');
$table->integer('track');
$table->double('duration');
$table->json('parameters');
$table->timestamps();
$table->foreign('video_id')->references('id')->on('videos');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('video_elements');
}
};

View File

@@ -1,30 +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::table('video_elements', function (Blueprint $table) {
$table->foreignId('parent_element_id')->nullable();
$table->foreign('parent_element_id')->references('id')->on('video_elements')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('video_elements', function (Blueprint $table) {
$table->dropForeign('video_elements_parent_element_id_foreign');
});
}
};

View File

@@ -0,0 +1,52 @@
<?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('meme_medias', function (Blueprint $table) {
$table->id();
$table->enum('type', ['video', 'image']);
$table->enum('sub_type', ['background', 'overlay']);
$table->string('name');
$table->text('description');
$table->string('keywords');
$table->uuid('media_1_uuid');
$table->uuid('media_2_uuid')->nullable();
$table->enum('media_1_mime_type', [
'image/jpeg',
'image/png',
'image/gif',
'image/webp',
'video/mp4',
'video/webm'
]);
$table->enum('media_2_mime_type', [
'image/jpeg',
'image/png',
'image/gif',
'image/webp',
'video/mp4',
'video/webm'
])->nullable();
$table->vector('embedding', 384)->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('meme_medias');
}
};