-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from kaleido-io/balances
Additional cleanup to support tokens UI
- Loading branch information
Showing
42 changed files
with
1,266 additions
and
1,757 deletions.
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
24 changes: 24 additions & 0 deletions
24
db/migrations/postgres/000043_replace_token_poolprotocolid.down.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,24 @@ | ||
BEGIN; | ||
DROP INDEX tokenbalance_pool; | ||
DROP INDEX tokentransfer_pool; | ||
|
||
ALTER TABLE tokenbalance ADD COLUMN pool_protocol_id VARCHAR(1024); | ||
ALTER TABLE tokentransfer ADD COLUMN pool_protocol_id VARCHAR(1024); | ||
|
||
UPDATE tokenbalance SET pool_protocol_id = pool.protocol_id | ||
FROM (SELECT protocol_id, id FROM tokenpool) AS pool | ||
WHERE tokenbalance.pool_id = pool.id; | ||
|
||
UPDATE tokentransfer SET pool_protocol_id = pool.protocol_id | ||
FROM (SELECT protocol_id, id FROM tokenpool) AS pool | ||
WHERE tokentransfer.pool_id = pool.id; | ||
|
||
ALTER TABLE tokenbalance DROP COLUMN pool_id; | ||
ALTER TABLE tokentransfer DROP COLUMN pool_id; | ||
|
||
ALTER TABLE tokenbalance ALTER COLUMN pool_protocol_id SET NOT NULL; | ||
ALTER TABLE tokentransfer ALTER COLUMN pool_protocol_id SET NOT NULL; | ||
|
||
CREATE UNIQUE INDEX tokenaccount_pool ON tokenbalance(key,pool_protocol_id,token_index); | ||
CREATE INDEX tokentransfer_pool ON tokentransfer(pool_protocol_id,token_index); | ||
COMMIT; |
24 changes: 24 additions & 0 deletions
24
db/migrations/postgres/000043_replace_token_poolprotocolid.up.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,24 @@ | ||
BEGIN; | ||
DROP INDEX tokenaccount_pool; | ||
DROP INDEX tokentransfer_pool; | ||
|
||
ALTER TABLE tokenbalance ADD COLUMN pool_id UUID; | ||
ALTER TABLE tokentransfer ADD COLUMN pool_id UUID; | ||
|
||
UPDATE tokenbalance SET pool_id = pool.id | ||
FROM (SELECT protocol_id, id FROM tokenpool) AS pool | ||
WHERE tokenbalance.pool_protocol_id = pool.protocol_id; | ||
|
||
UPDATE tokentransfer SET pool_id = pool.id | ||
FROM (SELECT protocol_id, id FROM tokenpool) AS pool | ||
WHERE tokentransfer.pool_protocol_id = pool.protocol_id; | ||
|
||
ALTER TABLE tokenbalance DROP COLUMN pool_protocol_id; | ||
ALTER TABLE tokentransfer DROP COLUMN pool_protocol_id; | ||
|
||
ALTER TABLE tokenbalance ALTER COLUMN pool_id SET NOT NULL; | ||
ALTER TABLE tokentransfer ALTER COLUMN pool_id SET NOT NULL; | ||
|
||
CREATE UNIQUE INDEX tokenbalance_pool ON tokenbalance(key,pool_id,token_index); | ||
CREATE INDEX tokentransfer_pool ON tokentransfer(pool_id,token_index); | ||
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
19 changes: 19 additions & 0 deletions
19
db/migrations/sqlite/000043_replace_token_poolprotocolid.down.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,19 @@ | ||
DROP INDEX tokenbalance_pool; | ||
DROP INDEX tokentransfer_pool; | ||
|
||
ALTER TABLE tokenbalance ADD COLUMN pool_protocol_id VARCHAR(1024); | ||
ALTER TABLE tokentransfer ADD COLUMN pool_protocol_id VARCHAR(1024); | ||
|
||
UPDATE tokenbalance SET pool_protocol_id = pool.protocol_id | ||
FROM (SELECT protocol_id, id FROM tokenpool) AS pool | ||
WHERE tokenbalance.pool_id = pool.id; | ||
|
||
UPDATE tokentransfer SET pool_protocol_id = pool.protocol_id | ||
FROM (SELECT protocol_id, id FROM tokenpool) AS pool | ||
WHERE tokentransfer.pool_id = pool.id; | ||
|
||
ALTER TABLE tokenbalance DROP COLUMN pool_id; | ||
ALTER TABLE tokentransfer DROP COLUMN pool_id; | ||
|
||
CREATE UNIQUE INDEX tokenaccount_pool ON tokenbalance(key,pool_protocol_id,token_index); | ||
CREATE INDEX tokentransfer_pool ON tokentransfer(pool_protocol_id,token_index); |
19 changes: 19 additions & 0 deletions
19
db/migrations/sqlite/000043_replace_token_poolprotocolid.up.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,19 @@ | ||
DROP INDEX tokenaccount_pool; | ||
DROP INDEX tokentransfer_pool; | ||
|
||
ALTER TABLE tokenbalance ADD COLUMN pool_id UUID; | ||
ALTER TABLE tokentransfer ADD COLUMN pool_id UUID; | ||
|
||
UPDATE tokenbalance SET pool_id = pool.id | ||
FROM (SELECT protocol_id, id FROM tokenpool) AS pool | ||
WHERE tokenbalance.pool_protocol_id = pool.protocol_id; | ||
|
||
UPDATE tokentransfer SET pool_id = pool.id | ||
FROM (SELECT protocol_id, id FROM tokenpool) AS pool | ||
WHERE tokentransfer.pool_protocol_id = pool.protocol_id; | ||
|
||
ALTER TABLE tokenbalance DROP COLUMN pool_protocol_id; | ||
ALTER TABLE tokentransfer DROP COLUMN pool_protocol_id; | ||
|
||
CREATE UNIQUE INDEX tokenbalance_pool ON tokenbalance(key,pool_id,token_index); | ||
CREATE INDEX tokentransfer_pool ON tokentransfer(pool_id,token_index); |
Oops, something went wrong.