<?php

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

class AddColumnsToCourseEnrolledsTable extends Migration
{
    public function up()
    {
        Schema::table('course_enrolleds', function (Blueprint $table) {
            if (!Schema::hasColumn('course_enrolleds', 'qty')) {
                $table->integer('qty')->default(1);
            }

            if (!Schema::hasColumn('course_enrolleds', 'is_store')) {
                $table->boolean('is_store')->default(0);
            }

            if (!Schema::hasColumn('course_enrolleds', 'attributes_values')) {
                $table->text('attributes_values')->nullable();
            }

            if (!Schema::hasColumn('course_enrolleds', 'product_sku_id')) {
                $table->integer('product_sku_id')->nullable();
            }

            if (!Schema::hasColumn('course_enrolleds', 'product_sku_label')) {
                $table->string('product_sku_label')->nullable();
            }
        });
    }

    public function down()
    {
    }
}
