Update migrations

This commit is contained in:
joeplikestocode
2026-02-16 00:09:07 +01:00
parent cd8365e17b
commit c16cabc00e
10 changed files with 57 additions and 41 deletions

View File

@@ -13,9 +13,45 @@ return new class extends Migration
{
Schema::create('images', function (Blueprint $table) {
$table->id();
// Storage info
$table->string('disk')->default('s3'); // Laravel filesystem disk
$table->string('bucket')->nullable(); // optional if disk implies it
$table->string('path'); // S3 object key (unique)
// File metadata
$table->string('original_name')->nullable();
$table->string('mime_type');
$table->unsignedBigInteger('size'); // bytes
$table->unsignedInteger('width')->nullable();
$table->unsignedInteger('height')->nullable();
// Variants (thumb/web versions)
$table->json('variants')->nullable();
// example:
// {
// "thumb": "crews/1/completions/4/thumb.webp",
// "web": "crews/1/completions/4/web.webp"
// }
// Visibility
$table->string('visibility')->default('private'); // private | public
// Security / dedupe
$table->string('checksum')->nullable(); // sha256
$table->boolean('exif_stripped')->default(true);
// Ownership
$table->foreignId('uploaded_by_user_id')
->constrained('users')
->cascadeOnDelete();
$table->timestamps();
$table->unique(['disk', 'path']);
});
Schema::table('users', function (Blueprint $table) {
$table->foreignId('avatar_image_id')
->nullable()