-
Notifications
You must be signed in to change notification settings - Fork 33
Create migration test #1062
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
macpie
wants to merge
26
commits into
main
Choose a base branch
from
macpie/historical
base: main
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.
+1,000
−395
Open
Create migration test #1062
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ae2696b
Create migration test
macpie 98f8b4f
Update tracker
macpie 029dd39
Fix gateway DB calls
macpie 6240c9d
Fix Clippy
macpie eb1498f
PR comments
macpie e0531af
Add some print to debug
macpie 497e0e4
Fix timestamp check
macpie ca0c79f
Added new API for retrieving historical gateway info
connormck333 4dfc96c
Add v1 to historical gateway info protobuf
connormck333 e7def30
Refactored gateway service reducing code dupe
connormck333 bb64843
Changed proto branch
connormck333 bda0b40
Fixed formatting errors
connormck333 968b6be
Gateway historical info test assertions updated
connormck333 507a18d
Fixed formatting errors
connormck333 8c8f374
Fixed formatting errors
connormck333 9cdf3af
Increased sleep in historical info test
connormck333 7f6003d
Tests cleanup, removed println, changed assert! to assert_eq
connormck333 01376f0
Removed sleep from test
connormck333 5c7eb38
Updated gateway tracker test name & reduced test size
connormck333 7556b56
Removed println in tests
connormck333 f7bec6a
Add info_historical command to mobile_config_cli
connormck333 53078d0
Changed historical info to info_at_timestamp
connormck333 e83d7b8
Update mobile verifiers to use new info_at_timestamp API
connormck333 924d2d4
Revert "Update mobile verifiers to use new info_at_timestamp API"
connormck333 37e586f
Merge branch 'main' into macpie/historical
connormck333 9fcf30b
Merge branch 'main' into macpie/historical
connormck333 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
28 changes: 28 additions & 0 deletions
28
mobile_config/migrations/20251003000000_gateways_historical.sql
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,28 @@ | ||
| -- 1. Drop the primary key constraint on address | ||
| ALTER TABLE | ||
| gateways DROP CONSTRAINT IF EXISTS gateways_pkey; | ||
|
|
||
| -- 2. Rename column updated_at -> inserted_at | ||
| ALTER TABLE | ||
| gateways RENAME COLUMN updated_at TO inserted_at; | ||
|
|
||
| -- 3. Backfill inserted_at with created_at values | ||
| UPDATE | ||
| gateways | ||
| SET | ||
| inserted_at = created_at; | ||
|
|
||
| -- 4. Ensure inserted_at is NOT NULL and has a default value of now() | ||
| ALTER TABLE | ||
| gateways | ||
| ALTER COLUMN inserted_at SET DEFAULT now(), | ||
| ALTER COLUMN inserted_at SET NOT NULL; | ||
connormck333 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| -- 5. Create an index on (address, inserted_at DESC) | ||
| CREATE INDEX IF NOT EXISTS gateways_address_inserted_idx ON gateways (address, inserted_at DESC); | ||
|
|
||
| -- 6. Create an PK on (address, inserted_at DESC) | ||
| ALTER TABLE | ||
| gateways | ||
| ADD | ||
| CONSTRAINT gateways_pkey PRIMARY KEY (address, inserted_at); | ||
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
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
Oops, something went wrong.
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.
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.
Revert before merge