restrict migrate function to the right schema, and not the entire database
This commit is contained in:
parent
c6ba00b74f
commit
bac60f049f
|
@ -18,6 +18,7 @@ import (
|
|||
|
||||
type PostgresqlStorage struct {
|
||||
DbConnection *sql.DB
|
||||
Schema string
|
||||
Tables map[string]string
|
||||
}
|
||||
|
||||
|
@ -47,6 +48,7 @@ func NewPostgresqlStorage(cfg *viper.Viper) (PostgresqlStorage, error) {
|
|||
}
|
||||
return PostgresqlStorage{
|
||||
DbConnection: db,
|
||||
Schema: pg_schema,
|
||||
Tables: map[string]string{
|
||||
"accounts": fmt.Sprintf("%s.%s", pg_schema, pgtables_accounts),
|
||||
"accounts_auth_local": fmt.Sprintf("%s.%s", pg_schema, pgtables_accounts_auth_local),
|
||||
|
@ -426,7 +428,7 @@ func (psql PostgresqlStorage) Migrate() error {
|
|||
return err
|
||||
}
|
||||
|
||||
existing, err := driver.InspectRealm(ctx, nil)
|
||||
existing, err := driver.InspectRealm(ctx, &schema.InspectRealmOption{Schemas: []string{psql.Schema}})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue