Skip to content

Commit

Permalink
去掉数据表判断
Browse files Browse the repository at this point in the history
  • Loading branch information
shebaoting committed Sep 2, 2024
1 parent e780e3d commit 0cf0b21
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions migrations/2017_01_20_000000_add_money_to_users_table.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
<?php

use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Builder;

return [
'up' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'money')) {
$table->integer('money')->default(0); // 根据需要设置默认值
}
});
},
'down' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'money')) {
$table->dropColumn('money');
}
});
}
];
return Migration::addColumns('users', [
'money' => ['integer']
]);

0 comments on commit 0cf0b21

Please sign in to comment.