Try this instead:
config('database.default') !== 'sqlite' ?: $table->dropForeign(['xxx']);
Hi!
I'm working on the tests on a project with sqlite as default, but someone in the team added a dropforeign and it broke everything. There's an answer that suggests to use something like
(DB::getDriverName() !== 'sqlite') ?: $table->dropForeign(['xxx']);
But getdrivername is non existant in the facade, and the closest i found is getdefaultconnection
(DB::getDefaultConnection() !== 'sqlite') ?: $table->dropForeign(['xxx']);
dd'ing this ( DB::getDefaultConnection() !== 'sqlite') ) returns false, i assume it's not getting the db i'm using on the time that i'm testing, so the error persists:
SQLite doesn't support dropping foreign keys (you would need to re-create the table).
Thanks in advance for the help.
Sorry, I copy pasted your code and forgot to remove the ! from !==
config('database.default') == 'sqlite' ?: $table->dropForeign(['xxx']);
Please or to participate in this conversation.