<?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()
    {
        Schema::create('sponsor_contracts', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('sponsor_id')->nullable();
            $table->foreign('sponsor_id')->nullable()->references('id')->on('sponsors')->onUpdate('cascade')->onDelete('cascade');
            $table->datetime('from_date');
            $table->datetime('to_date');
            $table->datetime('subscription_date');
            $table->decimal('amount', $precision = 8, $scale = 2);
            $table->string('file')->nullable();
            $table->softDeletes();
            $table->timestamps();
        });
    }

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