🚀📦 Multi-tenancy support for GORM managed databases
APACHE-2.0 License
Bot releases are visible (Hide)
UseDatabase
error handling (3cd1127)ParseDSNQueryParams
generic function (6175105)FNV-1a
lock key hashing function (b95f42c)Published by github-actions[bot] 3 months ago
Full Changelog: https://github.com/bartventer/gorm-multitenancy/compare/v8.3.0...v8.3.1
Published by github-actions[bot] 4 months ago
URL
Type for Custom URL Handling (71f512a)dsn
Package for DSN Parsing (9a5ea5a)OpenDB
signature for additional Options (a4f289a)OpenDBURL
Method Signature for URL
Type (c5ffa1b)URL
Type for Custom URL Handling (ee70208)Published by github-actions[bot] 4 months ago
[!TIP]
For a comprehensive guide on how to use the new feature, please refer to the Usage Guide.
Published by github-actions[bot] 4 months ago
[!WARNING]
Thegorm-multitenancy
package has been updated to Version 8, introducing significant changes to the project structure, module names, and import paths. Developers are advised to review the following breaking changes and update their projects accordingly to align with the latest version.
[!TIP]
For a comprehensive guide on how to use the new features and changes in Version 8, please refer to the Usage Guide.
driverMux
implementation (aa3115b)DB
Struct for Unified Database Operations (79a5ae3)drivertest
Package for Driver Conformance Testing (42248db)The gorm-multitenancy
package has been updated to Version 8, introducing significant changes to the project structure, module names, and import paths. Developers are advised to update their projects accordingly to align with the latest version and take advantage of the new features and improvements.
Key Changes:
-github.com/bartventer/gorm-multitenancy/v7
+github.com/bartventer/gorm-multitenancy/v8
-github.com/bartventer/gorm-multitenancy/mysql/v7
+github.com/bartventer/gorm-multitenancy/mysql/v8
-github.com/bartventer/gorm-multitenancy/postgres/v7
+github.com/bartventer/gorm-multitenancy/postgres/v8
-github.com/bartventer/gorm-multitenancy/middleware/echo/v7
+github.com/bartventer/gorm-multitenancy/middleware/echo/v8
-github.com/bartventer/gorm-multitenancy/middleware/nethttp/v7
+github.com/bartventer/gorm-multitenancy/middleware/nethttp/v8
postgres: The MigrationOptions
struct within the postgres
driver has been removed from the public API and is now managed internally by the driver. This change streamlines the migration process and enhances the driver's internal logic, ensuring a more robust and maintainable architecture.
postgres: Both the standalone function and the method on the postgres.Migrator
related to tenant schema creation have been renamed to MigrateTenantModels
. This unified change better reflects their purpose and functionality, aligning with standard naming conventions and clarifying their intent within the driver module.
Updated Standalone Function Signature:
-func CreateSchemaForTenant(db *gorm.DB, schemaName string) error
+func MigrateTenantModels(db *gorm.DB, schemaName string) error
Updated Method Signature on postgres.Migrator
:
-func (m Migrator) CreateSchemaForTenant(tenant string) error
+func (m Migrator) MigrateTenantModels(tenantID string) error
Note:
The underlying logic for both the function and method remains unchanged, with only the names being updated to provide clarity and consistency across the driver module.
postgres: The removal of the ResetSearchPath
type and the ValidateTenantName
function from the postgres/schema
package significantly simplifies the driver architecture. This change aims to ensure consistent behavior across driver modules and promote better code organization and maintainability. It's now recommended to handle tenant name validation at the application level if necessary.
The relocation of TenantModel
and TenantPKModel
from the postgres
driver to the github.com/bartventer/gorm-multitenancy/v8
package, and the renaming of the SchemaName
field to ID
in TenantPKModel
, necessitate updates to import paths and model references across all projects using the gorm-multitenancy
package.
TenantModel
and TenantPKModel
from the postgres
driver to github.com/bartventer/gorm-multitenancy/v8
, making them accessible across all drivers and promoting code reuse.SchemaName
field to ID
in TenantPKModel
for a more generic and consistent primary key representation, aligning with standard naming conventions.SchemaName
(now ID
) field to ensure compatibility with all supported database drivers.Updated import paths:
-github.com/bartventer/gorm-multitenancy/postgres/v7.TenantModel
+github.com/bartventer/gorm-multitenancy/v8.TenantModel
-github.com/bartventer/gorm-multitenancy/postgres/v7.TenantPKModel
+github.com/bartventer/gorm-multitenancy/v8.TenantPKModel
driver: Adjustments to the TenantTabler
interface enhance its utility and consistency across the gorm-multitenancy
package.
TenantTabler
interface is now in github.com/bartventer/gorm-multitenancy/v8/pkg/driver
, making it accessible to all drivers.IsTenantTable
method to IsSharedTable
to accurately describe shared models across tenants.Import paths update:
-github.com/bartventer/gorm-multitenancy/postgres/v7.TenantTabler
+github.com/bartventer/gorm-multitenancy/v8/pkg/driver.TenantTabler
pkg: The scopes
package within the postgres
driver has been moved to the pkg
directory for better organization and consistency. Update your import paths accordingly to reflect this change.
-github.com/bartventer/gorm-multitenancy/postgres/v7/scopes
+github.com/bartventer/gorm-multitenancy/v8/pkg/scopes
drivers: The drivers
directory has been removed from the project structure. All driver modules have been moved up one level higher to promote better organization and accessibility. For example, the github.com/bartventer/gorm-multitenancy/drivers/postgres
directory is now located at github.com/bartventer/gorm-multitenancy/postgres
.
context: This modification necessitates updates to context management practices across the board. Developers must now utilize the specific context keys provided by each middleware and driver, aligning with the decentralized approach to context management.
Published by github-actions[bot] 4 months ago
TenantContext
package to main Go module (4510b2d)TenantTabler
interface to drivers/postgres
module (8b5c287)scopes
package to drivers/postgres
module (e76d944)GetSchemaNameFromDb
function (0d12bc5)drivers/postgres
, middleware/echo
, middleware/nethttp
. Please update your import paths:- import "github.com/bartventer/gorm-multitenancy/v6/drivers/postgres"
+ import "github.com/bartventer/gorm-multitenancy/drivers/postgres/v7"
- import "github.com/bartventer/gorm-multitenancy/v6/middleware/echo"
+ import "github.com/bartventer/gorm-multitenancy/middleware/echo/v7"
- import "github.com/bartventer/gorm-multitenancy/v6/middleware/nethttp"
+ import "github.com/bartventer/gorm-multitenancy/middleware/nethttp/v7"
After updating the import paths, run go get -u
for each new module.
scopes
package has been relocated to the drivers/postgres
module. Please update your import paths:- import "github.com/bartventer/gorm-multitenancy/v6/scopes"
+ import "github.com/bartventer/gorm-multitenancy/drivers/postgres/v7/scopes"
The TenantTabler
interface has been moved to the drivers/postgres
module.
The TenantContext
package has been moved to the main Go module
. Please update your import paths:
- import "github.com/bartventer/gorm-multitenancy/v6/tenantcontext"
drivers/postgres: The deprecated GetSchemaNameFromDb
function has been removed from the drivers/postgres/schema
package.
All import paths have been updated to reflect the new major version 7. Please run go get -u
for each new module after updating the import paths.
Published by github-actions[bot] 5 months ago
reflection
dependency from WithTenantSchema
(9c6240d)