pgvector / pgvector-php

pgvector support for PHP
MIT License
121 stars 7 forks source link

Laravel - Autoloading Migrations & Publishing them. #8

Closed iBotPeaches closed 1 year ago

iBotPeaches commented 1 year ago

I attempted to install this package and use in a system with 2 databases. So I easily published the migrations (as instructed) and then changed them.

When running them - it failed because it was still auto-loading the migrations from this line:

https://github.com/pgvector/pgvector-php/blob/master/src/laravel/PgvectorServiceProvider.php#L26

There are 2 methods for packages to use migrations:

  1. Publish (push them into userland migrations)
  2. Autoload (run during Migrator to run migrations from your package)

The install docs opts for path 1, but forces all to use path 2.

I was going to PR a removal of that line, but technically a breaking change. This complexity can grow as you can see in Passport on how to handle this - https://github.com/laravel/passport/blob/11.x/src/PassportServiceProvider.php

So just opening this issue.

ankane commented 1 year ago

Hi @iBotPeaches, if you don't rename the generated migration, it should work fine (#7).