mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-05-03 16:24:55 +00:00
🛠️ **Migration:** Added safety checks in add_reputation_field_on_user_table migration to prevent redundant schema alterations.
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user