<?php

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

class AddColumnInSubscriptonCheckout extends Migration
{
    public function up()
    {
        Schema::table('subscription_checkouts', function ($table) {
            if (!Schema::hasColumn('subscription_checkouts', 'coupon_id')) {
                $table->integer('coupon_id')->nullable()->default(0);
            }
            if (!Schema::hasColumn('subscription_checkouts', 'discount')) {
                $table->float('discount', 15)->default(0.00);
            }
            if (!Schema::hasColumn('subscription_checkouts', 'purchase_price')) {
                $table->float('purchase_price', 15)->default(0.00);
            }
        });
    }

    public function down()
    {
        //
    }
}
