proxy.golang.org : github.com/bartventer/gorm-multitenancy/mysql/v8
Package mysql provides a gorm.Dialector implementation for MySQL databases to support multitenancy in GORM applications, enabling tenant-specific operations and shared resources management. It includes utilities for registering models, migrating shared and tenant-specific models, and configuring the database for tenant-specific operations. This package follows the "separate databases" approach for multitenancy, which allows for complete data isolation by utilizing separate databases for each tenant. This approach ensures maximum security and performance isolation between tenants, making it suitable for applications with stringent data security requirements. The URL format for MySQL databases is as follows: See the MySQL connection strings documentation for more information. To register models for multitenancy support, use RegisterModels. This should be done before running any migrations or tenant-specific operations. To ensure data integrity and schema isolation across tenants,gorm.DB.AutoMigrate has been disabled. Instead, use the provided shared and tenant-specific migration methods. driver.ErrInvalidMigration is returned if the `AutoMigrate` method is called directly. To ensure tenant isolation and facilitate concurrent migrations, this package uses MySQL advisory locks. These locks prevent concurrent migrations from interfering with each other, ensuring that only one migration process can run at a time for a given tenant. Exponential backoff retry logic is enabled by default for migrations. To disable retry or customize the retry behavior, either provide options to New or specify options in the DSN connection string of Open. The following options are available: To migrate shared models, use MigrateSharedModels. To migrate tenant-specific models, use MigrateTenantModels. To clean up the database for a removed tenant, use DropDatabaseForTenant. To configure the database for operations specific to a tenant, use schema.UseDatabase.
Registry
-
Source
- Documentation
- JSON
- codemeta.json
purl: pkg:golang/github.com/bartventer/gorm-multitenancy/mysql/v8
Keywords:
echo
, gin
, go
, gorm
, iris
, middleware
, multitenancy
, mysql
, nethttp
, postgres
License: Apache-2.0
Latest release: 5 months ago
First release: over 1 year ago
Namespace: github.com/bartventer/gorm-multitenancy/mysql
Stars: 71 on GitHub
Forks: 7 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 4 days ago