Skip to content

Commit

Permalink
[DB-DRIVER][neo4j] Properly handle null ts
Browse files Browse the repository at this point in the history
  • Loading branch information
dhui committed Apr 6, 2020
1 parent 4598673 commit 5180ec4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion database/neo4j/neo4j.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ func (n *Neo4j) Version() (version int, dirty bool, err error) {
}
}()

query := fmt.Sprintf("MATCH (sm:%s) RETURN sm.version AS version, sm.dirty AS dirty ORDER BY sm.ts DESC, sm.version DESC LIMIT 1",
query := fmt.Sprintf(`MATCH (sm:%s) RETURN sm.version AS version, sm.dirty AS dirty
ORDER BY COALESCE(sm.ts, datetime({year: 0})) DESC, sm.version DESC LIMIT 1`,
n.config.MigrationsLabel)
result, err := session.ReadTransaction(func(transaction neo4j.Transaction) (interface{}, error) {
result, err := transaction.Run(query, nil)
Expand Down

0 comments on commit 5180ec4

Please sign in to comment.