migrations: bump morph dependency and reflect changes (#21670)

Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2022-11-17 19:36:08 +03:00
коммит произвёл GitHub
родитель 06ad69a406
Коммит 1edbf67bb2
4 изменённых файлов: 41 добавлений и 24 удалений

Просмотреть файл

@@ -1034,18 +1034,10 @@ func (ss *SqlStore) migrate(direction migrationDirection) error {
return err
}
db := setupConnection("master", dataSource, ss.settings)
driver, err = ms.WithInstance(db, &ms.Config{
Config: drivers.Config{
StatementTimeoutInSecs: *ss.settings.MigrationsStatementTimeoutSeconds,
},
})
driver, err = ms.WithInstance(db)
defer db.Close()
case model.DatabaseDriverPostgres:
driver, err = ps.WithInstance(ss.GetMasterX().DB.DB, &ps.Config{
Config: drivers.Config{
StatementTimeoutInSecs: *ss.settings.MigrationsStatementTimeoutSeconds,
},
})
driver, err = ps.WithInstance(ss.GetMasterX().DB.DB)
default:
err = fmt.Errorf("unsupported database type %s for migration", ss.DriverName())
}
@@ -1056,6 +1048,7 @@ func (ss *SqlStore) migrate(direction migrationDirection) error {
opts := []morph.EngineOption{
morph.WithLogger(log.New(&morphWriter{}, "", log.Lshortfile)),
morph.WithLock("mm-lock-key"),
morph.SetStatementTimeoutInSeconds(*ss.settings.MigrationsStatementTimeoutSeconds),
}
engine, err := morph.New(context.Background(), driver, src, opts...)
if err != nil {