MM-41231: Bump morph dependency to avoid advisory locks (#19421)

https://mattermost.atlassian.net/browse/MM-41231

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2022-01-26 19:48:21 +05:30
коммит произвёл GitHub
родитель 56a45ffa41
Коммит d639e3c87c
7 изменённых файлов: 32 добавлений и 4 удалений

7
vendor/github.com/go-morph/morph/drivers/lock.go сгенерированный поставляемый
Просмотреть файл

@@ -76,3 +76,10 @@ type Locker interface {
type Lockable interface {
DriverName() string
}
// IsLockable returns whether the given instance satisfies
// drivers.Lockable or not.
func IsLockable(x interface{}) bool {
_, ok := x.(Lockable)
return ok
}

10
vendor/github.com/go-morph/morph/drivers/mysql/mysql.go сгенерированный поставляемый
Просмотреть файл

@@ -132,6 +132,11 @@ func (driver *mysql) Close() error {
}
func (driver *mysql) Lock() error {
if drivers.IsLockable(driver) {
// Supports lockable, so already locked at the global level.
return nil
}
aid, err := drivers.GenerateAdvisoryLockID(driver.config.databaseName, driver.config.MigrationsTable)
if err != nil {
return err
@@ -167,6 +172,11 @@ func (driver *mysql) Lock() error {
}
func (driver *mysql) Unlock() error {
if drivers.IsLockable(driver) {
// Supports lockable, so already locked at the global level.
return nil
}
aid, err := drivers.GenerateAdvisoryLockID(driver.config.databaseName, driver.config.MigrationsTable)
if err != nil {
return err

10
vendor/github.com/go-morph/morph/drivers/postgres/postgres.go сгенерированный поставляемый
Просмотреть файл

@@ -220,6 +220,11 @@ func (pg *postgres) Close() error {
}
func (pg *postgres) Lock() error {
if drivers.IsLockable(pg) {
// Supports lockable, so already locked at the global level.
return nil
}
aid, err := drivers.GenerateAdvisoryLockID(pg.config.databaseName, pg.config.schemaName)
if err != nil {
return err
@@ -244,6 +249,11 @@ func (pg *postgres) Lock() error {
}
func (pg *postgres) Unlock() error {
if drivers.IsLockable(pg) {
// Supports lockable, so already locked at the global level.
return nil
}
aid, err := drivers.GenerateAdvisoryLockID(pg.config.databaseName, pg.config.schemaName)
if err != nil {
return err

1
vendor/github.com/go-morph/morph/morph.go сгенерированный поставляемый
Просмотреть файл

@@ -76,6 +76,7 @@ func WithLock(key string) EngineOption {
}
// New creates a new instance of the migrations engine from an existing db instance and a migrations source.
// If the driver implements the Lockable interface, it will also wait until it has acquired a lock.
func New(ctx context.Context, driver drivers.Driver, source sources.Source, options ...EngineOption) (*Morph, error) {
engine := &Morph{
config: &Config{