Laravel:迁移更改列的默认值(布尔值)
Laravel: migrations change default value(boolean) of column
这是我当前的代码。
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(1);
});
}`
如何将默认值更改为 0,如下所示?
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(0);
});
}
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(0)->change();
});
}
已添加 ->change()
。请参阅 Link
这是我当前的代码。
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(1);
});
}`
如何将默认值更改为 0,如下所示?
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(0);
});
}
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(0)->change();
});
}
已添加 ->change()
。请参阅 Link