<?php

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

class AddRoleToUsersTable extends Migration
{
	public function up(): void
	{
		if (Schema::hasTable('users') && !Schema::hasColumn('users', 'role')) {
			Schema::table('users', function (Blueprint $table) {
				$table->string('role')->nullable();
			});
		}
	}

	public function down(): void
	{
		if (Schema::hasTable('users') && Schema::hasColumn('users', 'role')) {
			Schema::table('users', function (Blueprint $table) {
				$table->dropColumn('role');
			});
		}
	}
}

