dootask/database/migrations/2024_11_05_151611_add_users_lang.php
2024-11-05 22:43:58 +08:00

36 lines
784 B
PHP

<?php
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddUsersLang extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'lang')) {
$table->string('lang', 20)->nullable()->default('')->after('bot')->comment('语言首选项');
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn("lang");
});
}
}