Add indices for tx_to and tx_from (#112)
This commit is contained in:
parent
24bc83a448
commit
a786241c8c
1
db/migrations/1513805096_tx_to_index.down.sql
Normal file
1
db/migrations/1513805096_tx_to_index.down.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP INDEX tx_to_index;
|
1
db/migrations/1513805096_tx_to_index.up.sql
Normal file
1
db/migrations/1513805096_tx_to_index.up.sql
Normal file
@ -0,0 +1 @@
|
||||
CREATE INDEX tx_to_index ON transactions(tx_to);
|
1
db/migrations/1513805100_tx_from_index.down.sql
Normal file
1
db/migrations/1513805100_tx_from_index.down.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP INDEX tx_from_index;
|
1
db/migrations/1513805100_tx_from_index.up.sql
Normal file
1
db/migrations/1513805100_tx_from_index.up.sql
Normal file
@ -0,0 +1 @@
|
||||
CREATE INDEX tx_from_index ON transactions(tx_from);
|
@ -353,6 +353,20 @@ CREATE INDEX block_number_index ON blocks USING btree (block_number);
|
||||
CREATE INDEX node_id_index ON blocks USING btree (node_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: tx_from_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX tx_from_index ON transactions USING btree (tx_from);
|
||||
|
||||
|
||||
--
|
||||
-- Name: tx_to_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX tx_to_index ON transactions USING btree (tx_to);
|
||||
|
||||
|
||||
--
|
||||
-- Name: transactions blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -334,6 +334,9 @@ func AssertRepositoryBehavior(buildRepository func(node core.Node) repositories.
|
||||
repository.CreateContract(core.Contract{Hash: "x123"})
|
||||
contract, err := repository.FindContract("x123")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
sort.Slice(contract.Transactions, func(i, j int) bool {
|
||||
return contract.Transactions[i].Hash < contract.Transactions[j].Hash
|
||||
})
|
||||
Expect(contract.Transactions).To(
|
||||
Equal([]core.Transaction{
|
||||
{Hash: "TRANSACTION1", To: "x123"},
|
||||
|
Loading…
Reference in New Issue
Block a user