The following schema builder code works when running php artisan migrate and php artisan migrate:rollback on local and staging (production-like) environment. This will run an alter table statement to modify an existing table.
Note: since rows are empty, there is no need to set nullable or default value to the category_id:
// up
$table->integer('category_id')->unsigned()->index();
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
// down
$table->dropForeign('stores_category_id_foreign');
$table->dropColumn('category_id');
I'm running my functional tests with SQLite using :memory: configuration, and I'm getting the following error when the database rolls back:
General error: 1 no such index: stores_category_id_index (SQL: DROP INDEX stores_category_id_index)
Why is this happening, is there something I have to configure on SQLite that I don't know of?
Aucun commentaire:
Enregistrer un commentaire