File: /var/www/html/owlcrm/database/migrations/2025_01_14_122049_add_created_by_to_companies_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('companies', function (Blueprint $table) {
$table->unsignedBigInteger('created_by')->nullable()->after('user_id');
$table->unsignedBigInteger('user_id')->default(1)->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('companies', function (Blueprint $table) {
$table->dropColumn('created_by');
$table->unsignedBigInteger('user_id')->default(null)->change();
});
}
};