d496dad33c
- limit missing headers results set to 100 so that extraction doesn't excessively block delegation - wrap checked headers functions in repository struct - move storage repository to factory, to correspond with event repository path - remove unused files - reformat sql - remove line breaks in imports
45 lines
1.1 KiB
SQL
45 lines
1.1 KiB
SQL
-- +goose Up
|
|
ALTER TABLE full_sync_receipts
|
|
ADD COLUMN block_id INT;
|
|
|
|
UPDATE full_sync_receipts
|
|
SET block_id = (
|
|
SELECT block_id FROM full_sync_transactions WHERE full_sync_transactions.id = full_sync_receipts.transaction_id
|
|
);
|
|
|
|
ALTER TABLE full_sync_receipts
|
|
ALTER COLUMN block_id SET NOT NULL;
|
|
|
|
ALTER TABLE full_sync_receipts
|
|
ADD CONSTRAINT blocks_fk
|
|
FOREIGN KEY (block_id)
|
|
REFERENCES blocks (id)
|
|
ON DELETE CASCADE;
|
|
|
|
ALTER TABLE full_sync_receipts
|
|
DROP COLUMN transaction_id;
|
|
|
|
|
|
-- +goose Down
|
|
ALTER TABLE full_sync_receipts
|
|
ADD COLUMN transaction_id INT;
|
|
|
|
CREATE INDEX transaction_id_index ON full_sync_receipts (transaction_id);
|
|
|
|
UPDATE full_sync_receipts
|
|
SET transaction_id = (
|
|
SELECT id FROM full_sync_transactions WHERE full_sync_transactions.hash = full_sync_receipts.tx_hash
|
|
);
|
|
|
|
ALTER TABLE full_sync_receipts
|
|
ALTER COLUMN transaction_id SET NOT NULL;
|
|
|
|
ALTER TABLE full_sync_receipts
|
|
ADD CONSTRAINT transaction_fk
|
|
FOREIGN KEY (transaction_id)
|
|
REFERENCES full_sync_transactions (id)
|
|
ON DELETE CASCADE;
|
|
|
|
ALTER TABLE full_sync_receipts
|
|
DROP COLUMN block_id;
|