DanTheDJ / multitenant

The minimalist Laravel MultiTenant package enables easy multi-tenant applications by dynamically setting the database connection + name and adding a globally available --tenant option to Artisan. Enjoy!
MIT License
14 stars 4 forks source link

Bug - using --tenant=* only works for first migration #7

Open xyrintech opened 7 years ago

xyrintech commented 7 years ago

php artisan migrate --tenant=* works only for first migration. I believe it is require to work on every tenant.

xyrintech commented 7 years ago

Any update for this? :)

DanTheDJ commented 7 years ago

Hi @xyrintech. Can you please confirm your tenants table on your master database plus paste the output from the command window. I cannot reproduce.

xyrintech commented 7 years ago

Well, its the same table that's being there in the migration in this package. All I did is just created tenants and further run the migration.

xyrintech commented 7 years ago

It seems to be a major bug in this. I have tried this with 2 different setups with following steps: 1) Installed this with composer. 2) Added provider 3) Create 2 tenants and further created their databases manually. 4) tried php artisan migrate --tenant=* Migration only happens for one tenant, for second tenant it shows that there is nothing to migrate.

Note: Both these tenants share the same database connection but different databases.

xyrintech commented 7 years ago

Please let me know if you need any further details to reproduce.

xyrintech commented 7 years ago

One another way to reproduce: 1) create 2 tenants and their respective database. Ex. Acme_1, Acme_2

2) Now run the migrations with --tenant=all

3) You will see that migrations are there on one database only. In order to verify, delete the Acme_2 database. Run the migrations again, there is no error in this.

4) Now run the migration like this - php artisan migrate --tenant=acme_2

You will find an error for database missing.

Hope this helps.

xyrintech commented 7 years ago

Never heard back from you :)

ArturooTz commented 7 years ago

If you really need this feature you should rather do this programatically by getting the tenants from the database and run migrations on a loop for each tenant.

HelgeSverre commented 6 years ago

I am also having issues with this, any fixes yet?

DanTheDJ commented 6 years ago

Hi Guys,

Apologies for the delay in response. I will have a look at this when I'm back home tonight

Dan

DanTheDJ commented 6 years ago

Hi,

I had a bunch of issues whilst trying to fix the existing command, I have created a new command which is called by typing php artisan tenant:migrate with an tenant option, like the old commands use.

Example: php artisan tenant:migrate --tenant=tenant1 Or to migrate all tenants: php artisan tenant:migrate --tenant=*

I need to convert the other migration commands such as down, reset etc into a custom command and then will get this released to you.

Dan

HelgeSverre commented 6 years ago

Great job, keep it up!

On Wed, 19 Sep 2018, 18:37 Dan Coleman, notifications@github.com wrote:

Hi,

I had a bunch of issues whilst trying to fix the existing command, I have created a new command which is called by typing php artisan tenant:migrate with an tenant option, like the old commands use.

Example: php artisan tenant:migrate --tenant=tenant1 Or to migrate all tenants: php artisan tenant:migrate --tenant=*

I need to convert the other migration commands such as down, reset etc into a custom command and then will get this released to you.

Dan

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DanTheDJ/multitenant/issues/7#issuecomment-422871946, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCgdKSFcOH_TBKUaHrwcjywsE_vaga5ks5ucnLPgaJpZM4ORJJ0 .

HelgeSverre commented 5 years ago

Any update on this?