-
Notifications
You must be signed in to change notification settings - Fork 113
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
Prod airdrop QA #11329
Merged
Merged
Prod airdrop QA #11329
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions
6
packages/discovery-provider/ddl/data/0118_prod_airdrop/prod_qa_airdrop.csv
This file contains 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,6 @@ | ||
handle_lc,amount | ||
isaacsolo,1642 | ||
sammiezonana,2058 | ||
dharit,2493 | ||
secretpanda007,2547 | ||
lvl13icewizard,954 |
51 changes: 51 additions & 0 deletions
51
packages/discovery-provider/ddl/migrations/0118_prod_airdrop_qa.sql
This file contains 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,51 @@ | ||
begin; | ||
do $$ begin -- run only on prod | ||
if exists ( | ||
select * | ||
from "blocks" | ||
where "blockhash" = '0xe9b0f40bb2356d4fbedde96671503475c1c6c994c7eda082f046f7e9923c6e16' | ||
) then -- check whether the data has already been backfilled and return early for idempotency | ||
if exists ( | ||
select 1 | ||
from user_challenges | ||
where challenge_id = 'o' -- not future proof but safe for now | ||
) then return; | ||
end if; | ||
-- ========== one shot trigger ========== | ||
WITH max_block AS ( | ||
SELECT MAX(number) AS completed_blocknumber | ||
FROM blocks | ||
), | ||
one_shot_users as ( | ||
select temp.handle_lc, | ||
temp.amount, | ||
users.user_id | ||
from temp_stage_one_shot temp | ||
join users on temp.handle_lc = users.handle_lc | ||
) | ||
INSERT INTO user_challenges ( | ||
user_id, | ||
challenge_id, | ||
specifier, | ||
is_complete, | ||
current_step_count, | ||
completed_blocknumber, | ||
amount, | ||
created_at, | ||
completed_at | ||
) | ||
SELECT osu.user_id, | ||
'o' as challenge_id, | ||
concat(to_hex(user_id), ':', to_hex(1)) AS specifier, | ||
-- user_id:nth_shot for future proofing | ||
TRUE AS is_complete, | ||
0 AS current_step_count, | ||
mb.completed_blocknumber, | ||
CAST(osu.amount AS INT) AS amount, | ||
NOW() AS created_at, | ||
NOW() AS created_at | ||
FROM one_shot_users osu, | ||
max_block mb; | ||
end if; | ||
end $$; | ||
commit; |
This file contains 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.
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.
what is
temp_stage_one_shot
?