From b6baa106cc0a7e4d16d3f0d6db7f7666660a5748 Mon Sep 17 00:00:00 2001 From: Taka Goto Date: Wed, 23 Jan 2019 10:24:18 -0600 Subject: [PATCH] bring back transaction_id index when adding back transaction_id column --- .../1525122581_associate_receipts_with_blocks.down.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/migrations/1525122581_associate_receipts_with_blocks.down.sql b/db/migrations/1525122581_associate_receipts_with_blocks.down.sql index 0a32c92e..e6ce2266 100644 --- a/db/migrations/1525122581_associate_receipts_with_blocks.down.sql +++ b/db/migrations/1525122581_associate_receipts_with_blocks.down.sql @@ -3,6 +3,8 @@ BEGIN; ALTER TABLE receipts ADD COLUMN transaction_id INT; +CREATE INDEX transaction_id_index ON receipts (transaction_id); + UPDATE receipts SET transaction_id = ( SELECT id FROM transactions WHERE transactions.hash = receipts.tx_hash @@ -20,4 +22,4 @@ ON DELETE CASCADE; ALTER TABLE receipts DROP COLUMN block_id; -COMMIT; \ No newline at end of file +COMMIT;