laravel-one-time-operations icon indicating copy to clipboard operation
laravel-one-time-operations copied to clipboard

[Enhancement] Allow finding operations from multiple directories

Open shadoWalker89 opened this issue 2 years ago • 2 comments

Hi,

I have an enhancement suggestion. Allow loading operations from multiple directories just like laravel migrations. This can be done via the config file directory key maybe renamed to directories with a fallback to directory to avoid breaking change. Also you could add a method called loadOperationsFrom() the same way laravel provides loadMigrationsFrom()

Personally for my use case, i have two places where i can load laravel migrations from.

shadoWalker89 avatar Apr 03 '23 09:04 shadoWalker89

I have a similar request, so not opening a new issue.

My case is this. I have a multi-tenant application that uses two databases. So I would need to load operations from different directories - one for tenants, and one for the central app (landlord).

While this enhancement could work partially for me, I have trouble with migrating the operations table. This is just a thought for now. I will eventually need to create the table in both tenant and landlord database.

Since the operations table migration is not published, and always picks form the vendor directory, when I run migrate --database=tenant, its fine and creates the operations table in the tenant database. This works because for tenant database the migration files are stored in the default location - database/migrations. But when I want to run it for the default database migrate --database=landlord --path=database/migrations/landlord it wouldn't pick up the migration for operations as it is in the vendor directory. For now I just copied the migration to the landlord directory, but it would be nice if we could publish the migration file.

dev-databee avatar Dec 15 '23 01:12 dev-databee

Never mind, I mitigated the issue by moving my tenant migrations to it's own directory.

But yeah, I can't wait for the enhancement to be merged 😀.

dev-databee avatar Dec 15 '23 01:12 dev-databee