Return one row with last version from postgres

This commit is contained in:
fronik 2014-09-25 18:45:37 +04:00
parent b4a84d29ff
commit a0afdc3038
1 changed files with 1 additions and 1 deletions

View File

@ -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