<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDownloadsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('downloads', function (Blueprint $table) {
            $table->id();
            $table->timestamps();

            $table->string('uniqid')->unique();
            $table->string('name');
            $table->string('path');
            $table->float('progress_value')->default(0);
            $table->enum('status', ['pending', 'in_progress', 'encoding', 'completed', 'canceled', 'in_error'])->default('pending');
        });
    }

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