Skip to content

Releases: archtechx/tenancy

v2.2.1

23 Nov 15:02
4e477b4
Compare
Choose a tag to compare

Fixes

  • Move facade/ignition-contracts dependency to require

v2.2.0

10 Nov 15:13
f34986b
Compare
Choose a tag to compare

Added

  • Conflicting routes - you may now use the same URLs in the tenant & central parts of the app docs
  • Universal routes - you may now use the same routes (e.g. Auth::routes() or Nova routes) for both the tenant & central part of the app docs
  • Much richer event system (docs), allowing for things like:
    • jobs to be put into the queue chain of the job that creates tenant DBs, without race conditions
    • seeding tenant data on creation
    • created_at/updated_at/deleted_at timestamps
  • Optional Timestamps feature docs
  • TenantAwareCommand trait for commands docs
  • Find tenant by any key docs
  • Deleting keys from tenant storage docs
  • Better IDE support for global helpers (tenancy() & tenant())

Fixes

  • tenants:migrate now accepts --path

v2.1.2

20 Oct 07:45
6fdc041
Compare
Choose a tag to compare

Patch release.

  • Don't purge central connections - fix issue caused by writing a regression test #192

v2.1.1

19 Oct 22:58
f489aba
Compare
Choose a tag to compare

Patch release.

  • Don't purge central connections #189
  • Respect custom columns during tenant creation #191
  • Create routes/tenant.php only if the file does not exist #188

v2.1.0

17 Oct 19:39
cfcb257
Compare
Choose a tag to compare

2.1.0

Added:

  • Automatic seeding after tenant creation can now be enabled
  • $tenant->run() -- run a closure inside a tenant's environment Documentation
  • Nova integration Documentation
  • spatie/laravel-activitylog integration Documentation
  • Central queue connections Documentation
  • The MySQLDatabaseManager now respects your charset & collation instead of always using utf8mb & utf8mb4_unicode_ci

Bug fixes:

  • Fixed: Tenant routes are now registered even in HTTP tests.
  • Fixed: The queued DB creators, deletors and migrators were causing serialization issues under some conditions.

Bug fixes with breaking changes:

Queue race conditions

When both DB creation & migration were queued (after tenant creation), a race condition could happen, i.e. the migrate job would be executed before the create DB job.

Breaking change: The queue_automatic_migration configuration key was dropped. Whether post-creation migrations & seeding should be queued now depends on whether the DB creation is queued.

InitializeTenancy middleware

The InitializeTenancy middleware was part of the route middleware stack, which means it was executed after controller constructors. This could result in problems when a dependency (constructor argument) was injected before tenancy was initialized.

The InitializeTenancy middleware is now executed as part of the global middleware stack. That stack doesn't know whether the current route is a tenant route or a central route, it only knows if the current domain is a tenant domain. If tenancy was initialized on a non-tenant route (= if a central route was visited on a tenant domain), the PreventAccessFromTenantDomains middleware aborts the request.

Breaking change: If you applied the InitializeTenancy middleware on some routes manually, change it to 'tenancy' -- a middleware group. The PreventAccessFromTenantDomains middleware uses the presence of that middleware group as a check for whether a route is marked as tenant or not.

v2.0.1

09 Oct 16:24
Compare
Choose a tag to compare

Patch release.

  • Use Config\Repository contract instead of concrete #157
  • Fix reference to tenancy.tenant_route_namespace config in the route SP #161

v2.0.0

04 Oct 21:37
Compare
Choose a tag to compare

🎉 2.0.0

Main changes

  • Tenant objects are now used, instead of arrays, to represent tenants. See the Tenants page.
  • Tenants can now have multiple domains, so a new domains table is used by the DB storage driver.
  • The uuid property on tenants is now id.
  • tenancy() helper now returns an instance of TenantManager while the tenant() helper returns an instance of the current Tenant. If no Tenant has been identified, null is returned. Same with the Tenancy and Tenant facades.
  • Event listeners/hooks have a new syntax: Tenancy::eventListener('bootstrapping', function () {})
  • The tenancy bootstrapping logic has been extracted into separate classes, such as DatabaseTenancyBootstrapper, CacheTenancyBootstrapper etc.
  • A concept of Features was introduced. They're classes that provide additional functionality - functionality that is not necessary to bootstrap tenancy.
  • predis support was dropped. Laravel will drop predis support in 7.x.
  • There is new syntax for creating and interacting with tenants, be sure to read those documentation pages again.
  • The config was changed a lot, so you should publish and configure it again.
    You can publish the configuration like this:
    php artisan vendor:publish --provider='Stancl\Tenancy\TenancyServiceProvider' --tag=config
    

DB storage driver

  • The uuid column in the tenants table was renamed to id. The domain column was dropped.
  • A new migration was added to create the domains table. The old migration was renamed, so if you publish migrations again, be sure to delete the old migration, to avoid creating the table twice.
    You can publish migrations like this:
    php artisan vendor:publish --provider='Stancl\Tenancy\TenancyServiceProvider' --tag=migrations
    

Redis storage driver

  • The uuid keys are now id.
  • The domain key was dropped.
  • The _tenancy_domains key is used to store an array of domains that belong to the tenant.

New Features

v2.0.0-rc2

30 Sep 18:17
Compare
Choose a tag to compare
v2.0.0-rc2 Pre-release
Pre-release

Bug fixes, config was restructured, tenants:migrate-fresh was added, TenantConfig feature was added, UUID generator was moved to a different namespace.

v2.0.0-rc1

23 Sep 09:59
Compare
Choose a tag to compare
v2.0.0-rc1 Pre-release
Pre-release

Changelog will be published when v2.0.0 is released.

The documentation is updated for v2.0.0-rc1.

v1.8.0

23 Aug 20:51
Compare
Choose a tag to compare

Added

  • Multi-tenant Jobs: Jobs are now automatically multi-tenant. The documentation page covers the small tweaks you will have to make to your config to get multi-tenant jobs to work.
  • Telescope Integration: You can read more about this on the documentation page.
  • Horizon Integration: You can read more about this on the documentation page.
  • Tenant Redirect and Custom ID schemes: You can now easily redirect to tenant domains. You can also use a custom tenant ID scheme if you don't like UUIDs. You can read about these features here.

Fixed

  • #112 PostgreSQL Database creation error.

Code

  • Strict types declaration is now used in every file.