<?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::disableForeignKeyConstraints();

        Schema::create('albums', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('album_category_id')->index();
            $table->foreign('album_category_id')->references('id')->on('album_categories')->comment('類別');
            $table->string('news_img_pc')->comment('列表圖 PC');
            $table->string('news_img_mobile')->comment('列表圖 MOBILE');
            $table->string('title')->comment("標題");
            $table->dateTime('post_date')->comment("文章發布日");
            $table->unsignedTinyInteger('upload_type')->comment('上傳類型 1.url 2.upload files');
            $table->string('link')->comment('連結網址');
            $table->string('meta_img')->nullable()->comment('seo image');
            $table->string("meta_title")->comment("seo title");
            $table->string("meta_description")->comment("seo description");
            $table->boolean('on_top')->default(0)->comment("置頂");
            $table->boolean('visible')->default(1)->comment("顯示/隱藏");
            $table->unsignedInteger('order')->default(0)->comment("排序");
            $table->timestamps();
            $table->softDeletes();
        });

        Schema::enableForeignKeyConstraints();
    }

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