<?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('milestones', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->string('name')->nullable();
            $table->double('amount')->nullable();
            $table->integer('duration')->nullable();
            $table->enum('status',['paid','unpaid','refunded'])->default('unpaid');
            $table->timestamp('start_date')->nullable();
            $table->timestamp('due_date')->nullable();
            $table->unsignedBigInteger('milestonable_id');
            $table->string('milestonable_type');
            $table->timestamp('accepted_at')->nullable();
            $table->softDeletes();
        });
    }

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