Skip to content

Commit

Permalink
cleanup migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrajath authored and seanmcgary committed Dec 2, 2024
1 parent 90ff9a7 commit 641ae40
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func (m *Migration) Up(db *sql.DB, grm *gorm.DB) error {
block_number bigint not null,
transaction_hash varchar not null,
log_index bigint not null,
unique(transaction_hash, log_index, block_number, reward_hash, strategy_index, operator_index)
unique(transaction_hash, log_index, block_number, reward_hash, strategy_index, operator_index),
CONSTRAINT operator_directed_reward_submissions_block_number_fkey FOREIGN KEY (block_number) REFERENCES blocks(number) ON DELETE CASCADE
);
`
if err := grm.Exec(query).Error; err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/postgres/migrations/202411191550_operatorAVSSplits/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func (m *Migration) Up(db *sql.DB, grm *gorm.DB) error {
block_number bigint not null,
transaction_hash varchar not null,
log_index bigint not null,
unique(transaction_hash, log_index, block_number)
unique(transaction_hash, log_index, block_number),
CONSTRAINT operator_avs_splits_block_number_fkey FOREIGN KEY (block_number) REFERENCES blocks(number) ON DELETE CASCADE
);
`
if err := grm.Exec(query).Error; err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/postgres/migrations/202411191708_operatorPISplits/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ func (m *Migration) Up(db *sql.DB, grm *gorm.DB) error {
block_number bigint not null,
transaction_hash varchar not null,
log_index bigint not null,
unique(transaction_hash, log_index, block_number)
unique(transaction_hash, log_index, block_number),
CONSTRAINT operator_pi_splits_block_number_fkey FOREIGN KEY (block_number) REFERENCES blocks(number) ON DELETE CASCADE
);
`
if err := grm.Exec(query).Error; err != nil {
Expand Down
32 changes: 0 additions & 32 deletions pkg/postgres/migrations/202411191710_blockNumberFkConstraint/up.go

This file was deleted.

2 changes: 0 additions & 2 deletions pkg/postgres/migrations/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
_202411151931_operatorDirectedRewardSubmissions "github.com/Layr-Labs/sidecar/pkg/postgres/migrations/202411151931_operatorDirectedRewardSubmissions"
_202411191550_operatorAVSSplits "github.com/Layr-Labs/sidecar/pkg/postgres/migrations/202411191550_operatorAVSSplits"
_202411191708_operatorPISplits "github.com/Layr-Labs/sidecar/pkg/postgres/migrations/202411191708_operatorPISplits"
_202411191710_blockNumberFkConstraint "github.com/Layr-Labs/sidecar/pkg/postgres/migrations/202411191710_blockNumberFkConstraint"
_202411191947_cleanupUnusedTables "github.com/Layr-Labs/sidecar/pkg/postgres/migrations/202411191947_cleanupUnusedTables"

"go.uber.org/zap"
Expand Down Expand Up @@ -112,7 +111,6 @@ func (m *Migrator) MigrateAll() error {
&_202411151931_operatorDirectedRewardSubmissions.Migration{},
&_202411191550_operatorAVSSplits.Migration{},
&_202411191708_operatorPISplits.Migration{},
&_202411191710_blockNumberFkConstraint.Migration{},
&_202411191947_cleanupUnusedTables.Migration{},
}

Expand Down

0 comments on commit 641ae40

Please sign in to comment.