<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('pos_transactions', function (Blueprint $table) {
            $table->string('hashkey', 300)->nullable()->unique()->after('id');
            $table->unsignedBigInteger('created_by')->nullable()->after('remarks')->index();
            $table->unsignedBigInteger('updated_by')->nullable()->after('created_by')->index();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('pos_transactions', function (Blueprint $table) {
            $table->dropColumn(['hashkey', 'created_by', 'updated_by']);
        });
    }
};
