🛠️ **Migration:** Added safety checks in add_reputation_field_on_user_table migration to prevent redundant schema alterations.

This commit is contained in:
BT
2026-05-02 22:02:25 +01:00
parent 04e3e30fcf
commit 11821b0fae
@@ -11,6 +11,10 @@ return new class extends Migration
*/
public function up(): void
{
if (Schema::hasColumn('users', 'reputation')) {
return;
}
Schema::table('users', function (Blueprint $table) {
$table->unsignedInteger('reputation')->default(0)->after('remember_token');
});
@@ -21,6 +25,10 @@ return new class extends Migration
*/
public function down(): void
{
if (! Schema::hasColumn('users', 'reputation')) {
return;
}
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('reputation');
});