refactor: merge tenant configuration into tenant registry
This commit is contained in:
@@ -12,17 +12,6 @@ import (
|
||||
|
||||
const imTenantIDSequenceTable = "im_tenant_id_sequence"
|
||||
|
||||
func sharedDatabaseConfig(ctx context.Context) (dbName, dbDSN string, err error) {
|
||||
row, err := imtenant.RegistryDB().GetOne(ctx, "SELECT db_name,db_dsn FROM im_tenant WHERE code='default' LIMIT 1")
|
||||
if err != nil {
|
||||
return "", "", gerror.Wrap(err, "获取共享业务库配置失败")
|
||||
}
|
||||
if row.IsEmpty() {
|
||||
return "", "", gerror.New("默认商户不存在,无法确定共享业务库")
|
||||
}
|
||||
return row["db_name"].String(), row["db_dsn"].String(), nil
|
||||
}
|
||||
|
||||
func ensureTenantIDSequence(ctx context.Context) error {
|
||||
db := imtenant.RegistryDB()
|
||||
if _, err := db.Exec(ctx, `CREATE TABLE IF NOT EXISTS im_tenant_id_sequence (
|
||||
|
||||
Reference in New Issue
Block a user