Skip to content

Commit

Permalink
Merge pull request #211 from costap/main
Browse files Browse the repository at this point in the history
Adds index on transations table timestamp
  • Loading branch information
jakedt committed Oct 25, 2021
2 parents ec71855 + bc195ca commit 5b5ace0
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package migrations

const createIndexOnTupleTransactionTimestamp = `
CREATE INDEX ix_relation_tuple_transaction_by_timestamp on relation_tuple_transaction(timestamp);
`

func init() {
if err := DatabaseMigrations.Register("add-transaction-timestamp-index", "add-unique-living-ns", func(apd *AlembicPostgresDriver) error {
tx, err := apd.db.Beginx()
if err != nil {
return err
}
defer tx.Rollback()

_, err = tx.Exec(createIndexOnTupleTransactionTimestamp)
if err != nil {
return err
}

return tx.Commit()
}); err != nil {
panic("failed to register migration: " + err.Error())
}
}

0 comments on commit 5b5ace0

Please sign in to comment.