<?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('folders', function (Blueprint $table) {
            $table->id();
            $table->integer("company_id");
            $table->integer("library_id");
            $table->string("name", 60);
            $table->integer("parent_id")->default(0);
            $table->string("path")->nullable();
            $table->integer("sequence")->default(0);
            $table->softDeletes();
            $table->timestamps();
            $table->index(['company_id', 'library_id']);
        });
    }

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