first commit
This commit is contained in:
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
44
database/factories/UserFactory.php
Normal file
44
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
50
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
$table->id();
|
||||
$table->uuid('uuid');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
@@ -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('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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('media_collections', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key');
|
||||
$table->string('name');
|
||||
$table->text('description');
|
||||
$table->boolean('is_system');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique('key');
|
||||
$table->index('is_system');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('media_collections');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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('medias', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->softDeletes();
|
||||
$table->uuid()->nullable()->unique();
|
||||
$table->foreignId('media_collection_id');
|
||||
$table->foreignId('user_id')->nullable();
|
||||
$table->enum('media_type', ['video', 'image', 'audio', 'any']);
|
||||
$table->enum('media_source', ['ai_generated', 'user_uploaded', 'system_uploaded', 'user_rendered', 'system_rendered']);
|
||||
$table->string('name')->nullable();
|
||||
$table->string('media_provider');
|
||||
$table->string('mime_type');
|
||||
$table->string('file_name');
|
||||
$table->string('file_path');
|
||||
$table->string('disk');
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('media_collection_id')->references('id')->on('media_collections');
|
||||
$table->index('media_source');
|
||||
$table->index('media_type');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('medias');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
@@ -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('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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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
|
||||
{
|
||||
// Video Template: Reusable videos that can be duplicated and edited to create new videos
|
||||
Schema::create('video_templates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable(); // who owns it
|
||||
$table->boolean('is_public')->default(false); // can be viewed by anyone?
|
||||
$table->string('name', 255); // name of template
|
||||
$table->json('parameters'); // template configurations
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('video_templates');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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
|
||||
{
|
||||
// Video: A single video that can be edited and saved
|
||||
Schema::create('videos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid('uuid'); // uuid
|
||||
$table->foreignId('video_template_id')->nullable(); // is a template?
|
||||
$table->foreignId('user_id')->nullable(); // who owns it
|
||||
$table->string('title', 255); // title of video
|
||||
$table->string('type', 50); // moving_images, single_video, split_video, split_video_background_image
|
||||
$table->json('parameters'); // parameters for video (width, height, aspect ratio, frame rate)
|
||||
$table->enum('status', [RenderConstants::STATUS_COMPLETE, RenderConstants::STATUS_PROCESSING, RenderConstants::STATUS_ERROR]); // status of video
|
||||
$table->integer('processing_percentage')->default(0); // progress of processing
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('video_template_id')->references('id')->on('video_templates')->onDelete('set null');
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('videos');
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
{
|
||||
// Video Data: some video assets have additional data associated with them
|
||||
Schema::create('video_datas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('video_id'); // video this data belongs to
|
||||
$table->enum('media_type', ['text', 'image', 'video', 'audio', 'video_subtitle', 'text_overlay']); // what kind of data is this?
|
||||
$table->enum('source', ['generated', 'uploaded', 'other']); // where did this data come from?
|
||||
$table->string('source_name')->nullable(); // name of source
|
||||
$table->string('key', 255); // identifier for data
|
||||
$table->string('value')->nullable(); // if data is a id or value or some form of identifier
|
||||
$table->jsonb('payload')->nullable(); // if data contains additional information like api response, etc.
|
||||
$table->string('url')->nullable(); // if data contains a url
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('video_id')->references('id')->on('videos')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('video_datas');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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
|
||||
{
|
||||
// Video Asset: medias that may or maynot have video_data associated
|
||||
Schema::create('video_assets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid('uuid'); // UUID that can be publicly shared
|
||||
$table->foreignId('video_id'); // video this asset belongs to
|
||||
$table->foreignId('video_data_id')->nullable(); // video data this asset is associated with
|
||||
$table->enum('media_type', ['image', 'video', 'audio']); // what kind of data is this?
|
||||
$table->string('mime_type'); // mime type of asset
|
||||
$table->string('name')->nullable(); // name of asset that can be pubicly shared
|
||||
$table->string('cloud_filename')->nullable(); // filename on cloud storage
|
||||
$table->integer('width')->nullable(); // for images and video: width of image
|
||||
$table->integer('height')->nullable(); // for images and video: height of image
|
||||
$table->float('aspect_ratio')->nullable(); // for images and video: aspect ratio of image
|
||||
$table->double('duration')->nullable(); // for audio and video assets: duration of asset
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('video_id')->references('id')->on('videos')->onDelete('cascade');
|
||||
$table->foreign('video_data_id')->references('id')->on('video_datas')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('video_assets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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
|
||||
{
|
||||
// Text Overlay: text that can be overlaid on a video
|
||||
Schema::create('text_overlays', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('video_id'); // video this text overlay belongs to
|
||||
$table->text('text_content'); // text content
|
||||
$table->jsonb('style_payload')->nullable(); // font family, font size, font color, font weight, text align
|
||||
$table->string('cloud_filename')->nullable(); // filename on cloud storage
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('video_id')->references('id')->on('videos')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('text_overlays');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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
|
||||
{
|
||||
// Video Layer: Just like Photoshop
|
||||
Schema::create('video_layers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable(); // layer name
|
||||
$table->foreignId('video_id'); // video this layer belongs to
|
||||
$table->foreignId('parent_id')->nullable(); // parent video id (for grouping)
|
||||
$table->foreignId('video_asset_id')->nullable(); // video asset this layer is associated with
|
||||
$table->foreignId('text_overlay_id')->nullable(); // text overlay this layer is associated with
|
||||
$table->double('time'); // if null, start from beginning
|
||||
$table->integer('track')->default(5); // track
|
||||
$table->double('duration'); // if null, end at end of video
|
||||
$table->integer('pos_x')->default(0); // absolute position of x
|
||||
$table->integer('pos_y')->default(0); // absolute position of y
|
||||
$table->float('scale_x')->default(1.0); // scale of x
|
||||
$table->float('scale_y')->default(1.0); // scale of y
|
||||
$table->enum('align_x', ['left', 'center', 'right'])->default('center'); // asset positioning alignment
|
||||
$table->enum('align_y', ['top', 'center', 'bottom'])->default('center'); // asset positioning alignment
|
||||
$table->jsonb('parameters')->nullable(); // settings, configs
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('video_id')->references('id')->on('videos')->onDelete('cascade');
|
||||
$table->foreign('parent_id')->references('id')->on('video_layers')->onDelete('set null');
|
||||
$table->foreign('video_asset_id')->references('id')->on('video_assets')->onDelete('set null');
|
||||
$table->foreign('text_overlay_id')->references('id')->on('text_overlays')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('video_layers');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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
|
||||
{
|
||||
// Video Subtitle: Subtitles that can be overlaid on a video
|
||||
Schema::create('video_subtitles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('video_id'); // video this subtitle belongs to
|
||||
$table->foreignId('video_data_id')->nullable(); // video data this subtitle is associated with
|
||||
$table->double('time'); // start time, if null, start from beginning
|
||||
$table->double('duration'); // end time, if null, end at end of video
|
||||
$table->text('text'); // text content
|
||||
$table->jsonb('payload')->nullable(); // font family, font size, font color, font weight, text align
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('video_id')->references('id')->on('videos')->onDelete('cascade');
|
||||
$table->foreign('video_data_id')->references('id')->on('video_datas')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('video_subtitles');
|
||||
}
|
||||
};
|
||||
23
database/seeders/DatabaseSeeder.php
Normal file
23
database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// User::factory(10)->create();
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
]);
|
||||
}
|
||||
}
|
||||
35
database/seeders/MediaCollectionSeeder.php
Normal file
35
database/seeders/MediaCollectionSeeder.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\MediaCollection;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MediaCollectionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Define an array of mock records
|
||||
|
||||
$media_config = config('platform.media');
|
||||
|
||||
foreach ($media_config as $key => $item) {
|
||||
|
||||
// dd($item);
|
||||
|
||||
$media_collection = MediaCollection::where('key', $key)->first();
|
||||
|
||||
if (is_null($media_collection)) {
|
||||
$media_collection = MediaCollection::create([
|
||||
'key' => $key,
|
||||
'name' => $item['name'],
|
||||
'description' => $item['description'],
|
||||
'is_system' => $item['is_system'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user