<?php

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

class CreateSalesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sales', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->default(0);
            $table->tinyInteger('status')->comment('1=completed,0=failed,2=pending');
            $table->string('order_id',100)->unique();
            $table->string('auth_code',50)->nullable()->comment('from api response authcode');
            $table->string('transaction_id',100)->nullable()->comment('from api response tranx id');
            $table->string('ip',50);
            $table->timestamps();
        });
    }

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