<?php

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

class CreatePricingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pricings', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger("company_id")->nullable();
            $table->string('name', 100);
            $table->longText('description');
            $table->string('stripe_id')->unique()->index()->nullable();
            $table->float('price', 8, 2)->nullable();
            $table->float('vat_included', 8, 2)->nullable();
            $table->integer('wod_counter')->nullable();
            $table->integer('open_counter')->nullable();
            $table->integer('total_counter')->nullable();
            $table->integer('days')->nullable();
            $table->time('start_time')->nullable();
            $table->time('end_time')->nullable();
            $table->boolean('recharge_weekly')->default(true);
            $table->boolean('is_public')->default(true);
            $table->timestamps();

            $table->foreign("company_id")->references("id")->on("companies")->onDelete("cascade");

        });
    }

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