id(); $table->string('name'); $table->string('target_type'); // vm, container, database, files $table->json('target_ids'); $table->string('schedule'); // cron expression $table->string('retention_type')->default('count'); // count, days $table->integer('retention_value')->default(7); $table->string('storage_type'); // local, s3, sftp, nfs $table->json('storage_config')->nullable(); // encrypted $table->boolean('is_active')->default(true); $table->json('compression')->nullable(); $table->json('encryption')->nullable(); $table->foreignId('created_by')->constrained('users'); $table->timestamps(); }); Schema::create('backups', function (Blueprint $table) { $table->id(); $table->foreignId('policy_id')->nullable()->constrained('backup_policies')->nullOnDelete(); $table->string('target_type'); $table->unsignedBigInteger('target_id'); $table->string('target_name'); $table->string('status'); // running, success, failed, expired $table->string('storage_path')->nullable(); $table->bigInteger('size_bytes')->nullable(); $table->string('checksum')->nullable(); $table->json('metadata')->nullable(); $table->text('notes')->nullable(); $table->timestamp('expires_at')->nullable(); $table->foreignId('created_by')->constrained('users'); $table->timestamp('started_at')->nullable(); $table->timestamp('completed_at')->nullable(); $table->timestamps(); }); Schema::create('restore_jobs', function (Blueprint $table) { $table->id(); $table->foreignId('backup_id')->constrained('backups'); $table->string('target_type'); $table->unsignedBigInteger('target_id')->nullable(); $table->string('restore_mode'); // overwrite, new, test $table->json('restore_config')->nullable(); $table->string('status'); // queued, running, success, failed $table->text('log')->nullable(); $table->foreignId('initiated_by')->constrained('users'); $table->timestamp('started_at')->nullable(); $table->timestamp('completed_at')->nullable(); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('restore_jobs'); Schema::dropIfExists('backups'); Schema::dropIfExists('backup_policies'); } };