Skip to content

Commit

Permalink
add migration for blob indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris committed Jul 26, 2024
1 parent d4a808a commit 7c99cad
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions database/migrations/003_add_blob_index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package migrations

import (
"github.com/flashbots/relayscan/database/vars"
migrate "github.com/rubenv/sql-migrate"
)

var migration003SQL = `
CREATE INDEX IF NOT EXISTS ` + vars.TableDataAPIPayloadDelivered + `_num_blob_txs_idx ON ` + vars.TableDataAPIPayloadDelivered + `("num_blob_txs");
CREATE INDEX IF NOT EXISTS ` + vars.TableDataAPIPayloadDelivered + `_num_blobs_idx ON ` + vars.TableDataAPIPayloadDelivered + `("num_blobs");
`

var Migration003AddBlobIndexes = &migrate.Migration{
Id: "003-add-blob-indexes",
Up: []string{migration003SQL},

DisableTransactionUp: false,
DisableTransactionDown: true,
}
1 change: 1 addition & 0 deletions database/migrations/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ var Migrations = migrate.MemoryMigrationSource{
Migrations: []*migrate.Migration{
Migration001InitDatabase,
Migration002AddBlobCount,
Migration003AddBlobIndexes,
},
}

0 comments on commit 7c99cad

Please sign in to comment.