Closed chrisrickard closed 1 year ago
Hi @chrisrickard, migrations aren't run until php artisan migrate
(loadMigrationsFrom
docs), and it should execute the published migration if there is one (and does when I run it).
Yeah migrations are run before my test cases. Is it running the migration even if it isn’t published?
On Thu, 27 Jul 2023 at 09:15, Andrew Kane @.***> wrote:
Hi @chrisrickard https://github.com/chrisrickard, migrations aren't run until php artisan migrate (loadMigrationsFrom docs https://laravel.com/docs/10.x/packages#migrations), and it should execute the published migration if there is one (and does when I run it).
— Reply to this email directly, view it on GitHub https://github.com/pgvector/pgvector-php/issues/7#issuecomment-1652669659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEEYCLZN4ZQHYSUXIZPL5TXSGQKFANCNFSM6AAAAAA2X4JKDM . You are receiving this because you were mentioned.Message ID: @.***>
-- Chris Rickard
Yes, if a migration isn't published, it'll run the default one (so you'll want to publish it and make any changes there).
@ankane Just FYI, I figured it out. As the migration gets published with the date prefix 2022_08_03_000000
it never ran for me, as it was logically before my initial migrations - so I renamed it to today's date.
This then (naturally) causes the package migration to be re ran on artisan test
.
It seems like the DB migrations are running on load of the Service Provider (is this correct)? As when nI run my test cases I get an error, as I use SQLite for my test cases, so it's failing as it obviously can't create a Postgres extension.
In my published migration I wrap it around "isTesting" to ensure it doesn't get executed - however it seems to be directly executing from the service provider code, as if I comment out these lines in the Service Provider it works.
Any thoughts?