Files
SkinbaseNova/database/migrations/2026_02_12_000004_create_uploads_table.php
2026-02-14 15:14:12 +01:00

48 lines
1.6 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::create('uploads', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('type', 32)->index(); // image, archive, etc.
$table->string('status', 32)->default('draft')->index();
$table->string('title')->nullable();
$table->string('slug')->nullable()->unique();
$table->foreignId('category_id')->nullable()->constrained('categories')->nullOnDelete();
$table->text('description')->nullable();
$table->json('tags')->nullable();
$table->string('license', 64)->nullable();
$table->boolean('nsfw')->default(false);
$table->boolean('is_scanned')->default(false)->index();
$table->boolean('has_tags')->default(false)->index();
$table->string('preview_path')->nullable();
$table->timestamp('published_at')->nullable()->index();
$table->string('final_path')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists('uploads');
}
};