first commit
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user