<?php

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

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('suppliers', function (Blueprint $table) {
            $table
                ->string('name')
                ->unique()
                ->after('id');
            $table
                ->bigInteger('phone')
                ->nullable()
                ->after('name');
            $table
                ->bigInteger('whatsapp')
                ->nullable()
                ->after('phone');
            $table
                ->string('email')
                ->nullable()
                ->after('whatsapp');
            $table
                ->text('address')
                ->nullable()
                ->after('email');
            $table
                ->string('photo')
                ->nullable()
                ->after('address');
            $table
                ->double('first_mony')
                ->default('0');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('suppliers', function (Blueprint $table) {
            $table->dropColumn('name');
            $table->dropColumn('phone');
            $table->dropColumn('whatsapp');
            $table->dropColumn('email');
            $table->dropColumn('address');
            $table->dropColumn('photo');
        });
    }
};
