Skip to content

Commit

Permalink
Reorder indexes on tokenbalance
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
  • Loading branch information
awrichar committed Nov 3, 2021
1 parent fb19d5d commit 6f38314
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ CREATE TABLE tokenaccount (
balance VARCHAR(65)
);

CREATE UNIQUE INDEX tokenaccount_pool ON tokenaccount(pool_protocol_id,token_index,identity);
CREATE UNIQUE INDEX tokenaccount_pool ON tokenaccount(identity,pool_protocol_id,token_index);

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ 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(pool_protocol_id,token_index,key);
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;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ 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(pool_id,token_index,key);
CREATE UNIQUE INDEX tokenbalance_pool ON tokenbalance(key,pool_id,token_index);
CREATE INDEX tokentransfer_pool ON tokentransfer(pool_id,token_index);
COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ CREATE TABLE tokenaccount (
balance VARCHAR(65)
);

CREATE UNIQUE INDEX tokenaccount_pool ON tokenaccount(pool_protocol_id,token_index,identity);
CREATE UNIQUE INDEX tokenaccount_pool ON tokenaccount(identity,pool_protocol_id,token_index);
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ UPDATE tokentransfer SET pool_protocol_id = pool.protocol_id
ALTER TABLE tokenbalance DROP COLUMN pool_id;
ALTER TABLE tokentransfer DROP COLUMN pool_id;

CREATE UNIQUE INDEX tokenaccount_pool ON tokenbalance(pool_protocol_id,token_index,key);
CREATE UNIQUE INDEX tokenaccount_pool ON tokenbalance(key,pool_protocol_id,token_index);
CREATE INDEX tokentransfer_pool ON tokentransfer(pool_protocol_id,token_index);
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ UPDATE tokentransfer SET pool_id = pool.id
ALTER TABLE tokenbalance DROP COLUMN pool_protocol_id;
ALTER TABLE tokentransfer DROP COLUMN pool_protocol_id;

CREATE UNIQUE INDEX tokenbalance_pool ON tokenbalance(pool_id,token_index,key);
CREATE UNIQUE INDEX tokenbalance_pool ON tokenbalance(key,pool_id,token_index);
CREATE INDEX tokentransfer_pool ON tokentransfer(pool_id,token_index);

0 comments on commit 6f38314

Please sign in to comment.