This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Rewrite of the dashboard reconciliation #3975
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8096f29
Rewrite of the reconciliation for the finance
kaguillera a1d4d8a
Resolving rebase again
kaguillera a639c27
Trim trailing whitespace
chadwhitacre 7acc5be
Reformat SQL query
chadwhitacre 0410b2d
Rewrite of the reconciliation for the finance
kaguillera d52f936
Altered a exchanges and exchane_route to handle NULL values fir recon…
kaguillera ecfa273
Move new sptfile over the old one
chadwhitacre 0843b82
Rewrite of the reconciliation for the finance
kaguillera 0eb41a4
Removed and unnecessary file.
kaguillera bac13de
Minor cleanups
chadwhitacre fea4533
More comment
chadwhitacre 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
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,30 @@ | ||
-- Alter the enums to cater for missing data. | ||
ALTER TYPE payment_net ADD VALUE 'unknown'; | ||
ALTER TYPE exchange_status ADD VALUE 'unknown'; | ||
|
||
-- Update the field status in the exchanges table from NULL to 'unknown' | ||
UPDATE exchanges SET status = 'unknown' WHERE status IS NULL; | ||
|
||
-- Alter the exchanges table to ensure that no more NULL values are entered | ||
ALTER TABLE exchanges ALTER COLUMN status SET NOT NULL; | ||
|
||
-- Insert records for 'unknown' (previously NULL) in exchanges table | ||
-- network in exchange_route table | ||
INSERT INTO exchange_routes (participant, network, address, error) | ||
( | ||
SELECT DISTINCT participants.id, 'unknown'::payment_net, 'n/a', '' | ||
FROM exchanges, participants | ||
WHERE exchanges.participant = participants.username | ||
AND route IS NULL | ||
); | ||
|
||
-- Update exchanges records with exchange_route ids pointing to 'unknown' | ||
-- network records for that participants | ||
UPDATE exchanges | ||
SET route = exchange_routes.id | ||
FROM exchange_routes, participants | ||
WHERE exchange_routes.participant = participants.id | ||
AND participants.username = exchanges.participant; | ||
|
||
-- Alter exchanges table and set route to not null | ||
ALTER TABLE exchanges ALTER COLUMN route SET NOT NULL; |
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.
Nice. Is this a Jinja2 thing?
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.
Yes.