Migrate fresh, fix #15

This commit is contained in:
Samuel Štancl 2019-10-04 21:20:10 +02:00
parent d38e50329a
commit 068b2c6da6

View file

@ -18,6 +18,8 @@ You can use the `tenants:migrate` command to migrate tenant's databases. You can
php artisan tenants:migrate --tenants=8075a580-1cb8-11e9-8822-49c5d8f8ff23 php artisan tenants:migrate --tenants=8075a580-1cb8-11e9-8822-49c5d8f8ff23
``` ```
You may use multiple `--tenants=<...>` options.
> Note: Tenant migrations must be located in `database/migrations/tenant`. > Note: Tenant migrations must be located in `database/migrations/tenant`.
You can use these commands outside the command line as well. If you want to migrate a tenant's database in a controller, you can use the `Artisan` facade. You can use these commands outside the command line as well. If you want to migrate a tenant's database in a controller, you can use the `Artisan` facade.
@ -36,6 +38,16 @@ $tenant = tenancy()->create('tenant1.localhost');
Similarly to [migrate](#migrate), these commands accept a `--tenants` option. Similarly to [migrate](#migrate), these commands accept a `--tenants` option.
## Migrate fresh {#migrate-fresh}
This package also offers a simplified, tenant-aware version of `migrate:fresh`. It runs `db:wipe` and `tenants:migrate` on the tenant's database.
You may use it like this:
```none
php artisan tenants:migrate-fresh --tenants=8075a580-1cb8-11e9-8822-49c5d8f8ff23
```
## Run {#run} ## Run {#run}
You can use the `tenants:run` command to run your own commands for tenants. You can use the `tenants:run` command to run your own commands for tenants.