Skip to content

Commit

Permalink
Fix: rollup_id index in bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Sep 4, 2024
1 parent 7b9dde9 commit 5298afe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/storage/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Bridge struct {
bun.BaseModel `bun:"table:bridge" comment:"Table with bridges"`

Id uint64 `bun:"id,pk,notnull,autoincrement" comment:"Unique internal identity"`
RollupId uint64 `bun:"rollup_id,unique:bridge_rollup_id" comment:"Rollup id"`
RollupId uint64 `bun:"rollup_id" comment:"Rollup id"`
AddressId uint64 `bun:"address_id,unique:bridge_address_id" comment:"Address id"`
Asset string `bun:"asset" comment:"Asset"`
FeeAsset string `bun:"fee_asset" comment:"Fee asset"`
Expand Down
8 changes: 8 additions & 0 deletions internal/storage/postgres/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ func createIndices(ctx context.Context, conn *database.Bun) error {
Exec(ctx); err != nil {
return err
}
if _, err := tx.NewCreateIndex().
IfNotExists().
Model((*storage.Bridge)(nil)).
Index("bridge_rollup_id_idx").
Column("rollup_id").
Exec(ctx); err != nil {
return err
}

// Fee
if _, err := tx.NewCreateIndex().
Expand Down

0 comments on commit 5298afe

Please sign in to comment.