Update migrations
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user