My unit tests recently started failing. I am getting this error:
PDOException: SQLSTATE[HY000]:
General error: 1 table loan_details has no column named start_month
在发生这种情况的线路上,我有这样的代码:
$loan = LoanDetails::create(['loan_percentage' => .8,
'loan_product_id' => 1,
'interest_rate' => .5,
'start_month' => 0,
'term' => 120,
'fixed_finance_fee' => 0,
'variable_finance_Fee' => 0,
'valid_from' => '2015-01-01'
]);
如果我把"开始月份"这行注释掉,那么它在逻辑上是有效的.
在单元测试的设置中,我运行了所有迁移(大约80次).
I have a migration that looks like this:
Schema::table('loan_details', function(Blueprint $table){
$table->integer('start_month')->unsigned()->after('interest_only')->default(0);
$table->decimal('balloon_percent',4,3)->after('term')->nullable();
$table->integer('balloon_month')->after('balloon_percent')->nullable();
$table->dropColumn('ordinal_rank');
});
So, I wondered if all the migrations weren't running so I ran this code:
$rows = DB::table('migrations')->get();
print_r($rows);
这会将所有迁移列为已完成.我使用内存中的sqlite db进行测试.
我想知道迁移是否是异步运行的,在我的代码运行时它们还没有全部完成?或者如果迁移在某个地方悄silent息地失败了?
我已经干了几个小时了,不知道发生了什么事.
*UPDATE I have a migration that runs AFTER the above migration, and I confirmed that the subsequent migration was successful. So it is just this one migration that is silently failing in some way.