mirror of https://github.com/status-im/migrate.git
Return one row with last version from postgres
This commit is contained in:
parent
b4a84d29ff
commit
a0afdc3038
|
@ -109,7 +109,7 @@ func (driver *Driver) Migrate(f file.File, pipe chan interface{}) {
|
||||||
|
|
||||||
func (driver *Driver) Version() (uint64, error) {
|
func (driver *Driver) Version() (uint64, error) {
|
||||||
var version uint64
|
var version uint64
|
||||||
err := driver.db.QueryRow("SELECT version FROM " + tableName + " ORDER BY version DESC").Scan(&version)
|
err := driver.db.QueryRow("SELECT version FROM " + tableName + " ORDER BY version DESC LIMIT 1").Scan(&version)
|
||||||
switch {
|
switch {
|
||||||
case err == sql.ErrNoRows:
|
case err == sql.ErrNoRows:
|
||||||
return 0, nil
|
return 0, nil
|
||||||
|
|
Loading…
Reference in New Issue