Skip to content

Commit

Permalink
rename posgresql helper field
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsb committed Oct 27, 2018
1 parent 18ddd06 commit 52079e8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type PostgreSQL struct {

// DontResetSequences prevents the reset of the databases
// sequences after load fixtures time
DontResetSequences bool
SkipResetSequences bool

tables []string
sequences []string
Expand Down Expand Up @@ -220,14 +220,13 @@ func (h *PostgreSQL) makeConstraintsDeferrable(db *sql.DB, loadFn loadFunction)

func (h *PostgreSQL) disableReferentialIntegrity(db *sql.DB, loadFn loadFunction) (err error) {
// ensure sequences being reset after load
defer func() {
if h.DontResetSequences {
return
}
if err2 := h.resetSequences(db); err2 != nil && err == nil {
err = err2
}
}()
if !h.SkipResetSequences {
defer func() {
if err2 := h.resetSequences(db); err2 != nil && err == nil {
err = err2
}
}()
}

if h.UseAlterConstraint {
return h.makeConstraintsDeferrable(db, loadFn)
Expand Down

0 comments on commit 52079e8

Please sign in to comment.