Given the following migration, when I run my tests I get the error:
Doctrine\DBAL\Schema\SchemaException: There is no column with name 'accreditation_start' on table 'validation_reviews'.
I also notice the // dd($table->getColumns()); in my up() method. It printed the two columns I created, but only those columns. This migration works as expected on the standard DB, but fails with that error on a SQLite DB during testing.
public function up()
{
Schema::table('validation_reviews', function (Blueprint $table) {
$table->date('accreditation_start')->nullable()->after('score');
$table->date('accreditation_end')->nullable()->after('accreditation_start');
$table->dropColumn('accredited_at');
// dd($table->getColumns());
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('validation_reviews', function (Blueprint $table) {
// ****** ERROR HAPPENS HERE ******
$table->dropColumn(['accreditation_start', 'accreditation_end']);
$table->dateTime('accredited_at')->after('score');
});
}
And here's the original table, made months before
public function up()
{
Schema::create('validation_reviews', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('product_id');
$table->string('state')->nullable();
$table->string('score')->nullable();
$table->dateTime('accredited_at');
$table->timestamps();
$table->index(['product_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('validation_reviews');
}