Skip to content

Commit

Permalink
Migrate on start in Database interface
Browse files Browse the repository at this point in the history
  • Loading branch information
smgladkovskiy committed Nov 17, 2021
1 parent 7e47e9d commit 539445f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ func (d Database) GetConnectionParams() (maxConnLifetime time.Duration, maxConns
return d.ConnectionLifeTime, int32(d.MaxOpenConnections), int32(d.MaxIdleConnections)
}

func (d Database) MigrateOnStart() bool {
return d.Migrations.RunOnStart
}

var (
ErrDataIsEmpty = errors.New("data is empty")
ErrDataIsInvalid = errors.New("data is invalid")
Expand Down
2 changes: 1 addition & 1 deletion interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type DatabaseCfgInterface interface {

GetSchema() string
GetMigrationsTableName() string

MigrateOnStart() bool
GetConnectionParams() (maxConnLifetime time.Duration, maxConns, minConns int32)
}

Expand Down

0 comments on commit 539445f

Please sign in to comment.