string('last_name', 100)->nullable()->comment('Apellidos')->index()->after('name'); $table->string('profile_photo_path', 2048)->nullable()->after('remember_token'); $table->unsignedTinyInteger('status')->default(User::STATUS_DISABLED)->after('profile_photo_path'); $table->unsignedMediumInteger('created_by')->nullable()->index()->after('status'); // Definir la relaciĆ³n con created_by $table->foreign('created_by')->references('id')->on('users')->onUpdate('restrict')->onDelete('restrict'); }); } /** * Reverse the migrations. */ public function down(): void { DB::statement('ALTER TABLE `users` MODIFY `id` MEDIUMINT UNSIGNED NOT NULL;'); DB::statement('ALTER TABLE `users` DROP PRIMARY KEY;'); DB::statement('ALTER TABLE `users` MODIFY `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (`id`);'); Schema::table('users', function (Blueprint $table) { $table->dropColumn(['last_name', 'profile_photo_path', 'status', 'created_by']); }); } };