I have migration in Postgres and SQLite, and I am facing problem with SQLite database. Same migrations are for 2 different databases. Postgres migration is OK, but not SQlite. I added migration for altering table and adding new field.
public function up()
{
Schema::table('retailer_products_photo_fix', function ($table) {
$table->integer('currency_id')->unsigned();
$table
->foreign('currency_id')
->references('id')
->on('currency')
->onUpdate('cascade')
->onDelete('cascade')
;
$table->dropColumn('currency');
});
}
But the following error was thrown:
General error: 1 Cannot add a NOT NULL column with default value NULL
When I try to add nullable() field isn't created and when I add default value 0 or 1 I got constraint error because in related table I have rows 1 and 2. How can this be solved?