<?php

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

class AddNameColumnToSiteUtmModuleTypes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('site_utm_module_types', function (Blueprint $table) {
            $table->string('name')->nullable()->after('id');
            $table->dropColumn('route_name');
            // Add the new route_names column to store JSON data
            $table->json('route_names')->nullable()->after('url');
        });
    }

    /** 
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('site_utm_module_types', function (Blueprint $table) {
            $table->dropColumn('name');
            $table->string('route_name')->after('url');
        });
    }
}
