jeudi 28 septembre 2017

Overriding the migrations used in a package

I'm using Laravel Passport and added foreign key constraints to a migration. Now when I try to do migrate:reset I run into this error because I'm using PostgreSQL:

SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR:  cannot drop table oauth_clients because other objects depend on it
DETAIL:  constraint oauth_access_tokens_client_id_foreign on table oauth_access_tokens depends on table oauth_clients constraint oauth_auth_codes_client_id_foreign on table oauth_auth_codes depends on table oauth_clients
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

This is easy to fix in my other migrations by simply making this my down statement:

DROP TABLE IF EXISTS some_table CASCADE;

However, to do this for the passport tables I need to be able to override the down() method of those migrations.

How do I prevent Laravel from using the migrations in the Passport package and instead only use the migrations in my main migrations dir?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire