<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // https://laravel.com/docs/5.0/schema
        // php artisan migrate:rollback --step=1
        Schema::create('batch_invitation_links', function (Blueprint $table) {
            // $table->id();
            $table->bigIncrements('id');
            $table->bigInteger('company_id')->index();
            $table->string('token', 20)->index();
            $table->string('name', 100);
            $table->decimal('rate', 10, 2)->nullable()->comment = 'Worker rate + overheaded charge';
            $table->integer('max_registrants')->default(1);
            $table->integer('total_registrants')->default(0);
            $table->timestamp('expiry_date')->nullable();
            $table->boolean('expired')->default(false);
            $table->timestamps();
            $table->softDeletes();
        });
    }

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