<?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
    {
        Schema::create('updates', function (Blueprint $table) {
            $table->id();

            $table->foreignId('environment_id')
                ->constrained('environments')
                ->cascadeOnDelete()
                ->cascadeOnUpdate();

            $table->string('version');
            $table->string('release')->nullable();
            $table->integer('maturity')->nullable();
            $table->string('url')->nullable();
            $table->string('download')->nullable();
            $table->string('downloadmd5')->nullable();

            $table->timestamps();
            $table->softDeletes();
        });
    }


    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('updates');
    }
};
