Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gerenciamento de usuário criar campos adicionais tabela #31

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public function up(): void
$table->string('password');
$table->string('city', 60)->nullable();
$table->string('state', 20)->nullable();
$table->string('linkedin', 101)->nullable()->unique();
Copy link

@Diegiwg Diegiwg Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgescobar normalmente, não se mexe em migrations antigas.

O ideal é criar uma nova migration, que será responsavel por modificar a tabela, removendo o campo no UP e o adicionando novamente no DOWN.

Sugestão

// php artisan make:migration remove_linkedin_column_from_users_table

<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table
                ->dropColumn('linkedin');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table
                ->string('linkedin')
                ->nullable()
                ->unique()
                ->after('password');
        });
    }
};

$table->string('discord', 33)->nullable()->unique();
$table->string('permission')->nullable();
$table->integer('active')->nullable()->default(1);
Expand Down