我想将新的枚举列添加status
到customers
表中。但是当我尝试运行迁移时,我得到了这个错误:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'status' in 'where clause' (SQL: select * from `customers` where `customers`.`deleted_at` is null and `status` = 1)
[PDOException]
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'status' in 'where clause'
移民:
public function up()
{
Schema::table('customers', function (Blueprint $table) {
$enum = [
'activated' => 1,
'deactivated' => 0
];
$table->enum('status', $enum);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('customers', function (Blueprint $table) {
$table->dropColumn('status');
});
}