-
Notifications
You must be signed in to change notification settings - Fork 4
fix: add missing pruning logic, add missing block fk constraints #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
seanmcgary
wants to merge
27
commits into
master
Choose a base branch
from
sm-fixTablePrune
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
8efc439
fix: add missing pruning logic, add missing block fk constraints
seanmcgary d88b26d
add block_number indexes
seanmcgary b7efc58
fix constraints
seanmcgary b514e77
perf: implement a faster from-scratch sync
seanmcgary f5d2ade
update NewFetcher calls
seanmcgary df9a379
debug log, not info
seanmcgary f05f7d7
update fk constraints
seanmcgary a77b263
convert kebab case to snake case
seanmcgary ecc3596
empty commit
seanmcgary ce1218b
fix test
seanmcgary 9b2fa82
increase log verbosity for getLogs
seanmcgary 5c7db47
log out interesting block count
seanmcgary b3e7d4f
ignore conflicts on contract insert
seanmcgary c876b17
upsert proxy to handle error
seanmcgary 79c3e0c
use ubuntu-24.04
seanmcgary f84f234
skip contracts that already exist
seanmcgary 80e595a
additional logging
seanmcgary 6c80d69
add more logging
seanmcgary f198db8
more logging
seanmcgary f12ec97
change the proxy contract lookup logic to be more correct
seanmcgary 3a27ffe
remove tx wrapper
seanmcgary 031fc9a
trying raw query
seanmcgary ece9200
get around etherscan for now
seanmcgary a09a414
more debugging
seanmcgary 14569ec
less debug now that we fixed it
seanmcgary 7acb1b7
make GetRewardSnapshotStatus a >= rather than strict equal to pick up…
seanmcgary 642f595
change GetMaxSnapshotDateForCutoffDate to not rely on staging tables
seanmcgary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
pkg/postgres/migrations/202506042023_addMissingBlockNumberForeignKeys/up.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package _202506042023_addMissingBlockNumberForeignKeys | ||
|
|
||
| import ( | ||
| "database/sql" | ||
| "fmt" | ||
| "github.com/Layr-Labs/sidecar/internal/config" | ||
| "gorm.io/gorm" | ||
| ) | ||
|
|
||
| type Migration struct { | ||
| } | ||
|
|
||
| func (m *Migration) Up(db *sql.DB, grm *gorm.DB, cfg *config.Config) error { | ||
| tableNames := []string{ | ||
| "staker_shares", | ||
| "operator_shares", | ||
| } | ||
|
|
||
| for _, tableName := range tableNames { | ||
| query := fmt.Sprintf(`alter table %s add constraint %s_block_number_fkey foreign key (block_number) references blocks (number) on delete cascade;`, tableName, tableName) | ||
| res := grm.Exec(query) | ||
| if res.Error != nil { | ||
| return fmt.Errorf("failed to add foreign key for table %s: %w", tableName, res.Error) | ||
| } | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| func (m *Migration) GetName() string { | ||
| return "202506042023_addMissingBlockNumberForeignKeys" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first commit must've not had the change from
>=to>