Skip to content

Commit

Permalink
fixup! feat: Update SERIAL sequence after INSERT queries
Browse files Browse the repository at this point in the history
  • Loading branch information
13rac1 committed Apr 18, 2020
1 parent ed38225 commit 01f9c73
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/axon/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ func isSerialColumn(table, column string) bool {
}

func updateSerialColumnSequence(conn *sqlx.DB, table string, columns []*warppipe.ChangesetColumn) error {
// Why no transaction? From the manual: Important: Because sequences are
// non-transactional, changes made by setval are not undone if the transaction
// rolls back.
// ref: https://www.postgresql.org/docs/9.6/functions-sequence.html
for _, column := range columns {
if !isSerialColumn(table, column.Column) {
continue
Expand Down

0 comments on commit 01f9c73

Please sign in to comment.