What's Changed
- Added
Tenancy
Facade - Tenancy now uses Facade for managing connections
- Added
TenantContext
, now you can change the connection on the fly
from multitenancy.contexts import TenantContext
from multitenancy.models.Tenant import Tenant
tenant = Tenant.where('name', '=', 'tenant1').first()
with TenantContext(tenant=tenant) as ctx:
# do whatever you like in tenant
# ...
# migrate the database
ctx.migrate()
ctx.migrate_refresh()
ctx.migrate_rollback()
ctx.migrate_reset()
ctx.migrate_status()
# seed the database
ctx.seed()
- Other minor enhancements and bug fixes
Full Changelog: 0.0.4...0.0.5