<?php

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

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

            $table
                ->foreignId("category_id")
                ->constrained("category")
                ->cascadeOnDelete();
            $table->text("thumbnail")->nullable();
            $table->text("name");
            $table->text("description")->nullable();
            $table->boolean("shopee")->nullable();
            $table->string("url_shopee")->nullable();
            $table->boolean("tokopedia")->nullable();
            $table->string("url_tokopedia")->nullable();
        });
    }

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