From bd6f1b0f1bab542c4c217f267371ae0944f3ed05 Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Tue, 26 Feb 2019 19:54:44 +0100 Subject: [PATCH] horizon: remove failed operations in migrate down script (#929) --- services/horizon/internal/db2/schema/bindata.go | 6 +++--- .../db2/schema/migrations/16_ingest_failed_transactions.sql | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/services/horizon/internal/db2/schema/bindata.go b/services/horizon/internal/db2/schema/bindata.go index 13603fd871..2f991847cd 100644 --- a/services/horizon/internal/db2/schema/bindata.go +++ b/services/horizon/internal/db2/schema/bindata.go @@ -100,7 +100,7 @@ func latestSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "latest.sql", size: 21288, mode: os.FileMode(420), modTime: time.Unix(1550753674, 0)} + info := bindataFileInfo{name: "latest.sql", size: 21288, mode: os.FileMode(420), modTime: time.Unix(1551104083, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -225,7 +225,7 @@ func migrations15_ledger_failed_txsSql() (*asset, error) { return a, nil } -var _migrations16_ingest_failed_transactionsSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\xce\xb1\x4a\x04\x31\x10\xc6\xf1\x3e\x4f\xf1\x59\xcb\x9e\x60\xbb\x58\xac\x97\x88\xc5\x9e\x2b\x31\x87\xa5\xe4\xb2\x13\x2f\x98\x64\x24\xc9\x29\xbe\xbd\xb0\x88\xb7\x85\x60\x3b\x0c\xbf\xef\xdf\x75\xb8\x4c\xe1\xb5\xd8\x46\xd8\xbf\x0b\xd1\x75\xd8\x1e\xc9\xbd\x61\x3e\x5c\x5f\x1d\x43\x6d\x5c\xbe\x36\xa6\xd8\x5c\xad\x6b\x81\xf3\xe6\xe9\xe4\x1c\xd5\xea\x4f\x11\x3e\x50\x9c\xe1\x38\x25\xca\x0d\x9e\x0b\x12\x17\x42\xc8\x9e\x4b\xb2\xcb\xb7\x18\x46\xa3\x34\xcc\x70\x3b\x2a\xfc\x70\x2f\xed\xcc\x55\x0c\x52\xa2\x9e\xcd\x03\x73\x24\x9b\xfb\xa5\xe4\xb7\x4c\xf2\x67\x5e\x2e\x9a\x12\x7f\x10\xbc\x0d\x91\x66\xac\xa1\x0b\x21\xd5\xa8\x8c\xc2\x9d\x9e\x76\x7f\x4f\x3d\xdf\x2b\xad\xd6\x63\x37\xf0\x36\x56\xea\xff\xaf\x94\x7a\x7a\xc4\x76\x1a\xf7\xbb\x87\x15\xd0\x8b\xef\x00\x00\x00\xff\xff\xb5\xf9\x65\xf3\x3f\x01\x00\x00") +var _migrations16_ingest_failed_transactionsSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x90\xcd\x6a\xeb\x30\x14\x84\xf7\x7a\x8a\xb9\xeb\x8b\x5d\xe8\x36\x64\xe1\xc6\xea\x0f\x38\x49\x71\x6c\xba\x0c\x8a\x75\xd4\x88\x5a\x3a\x41\x72\x5a\xfa\xf6\x05\xa7\x24\x36\x08\xba\x94\x98\xf9\xf4\x8d\xb2\x0c\xff\x9d\x7d\x0f\x6a\x20\xb4\x27\x21\xb2\x0c\xab\x23\x75\x1f\xd0\x87\xfb\xbb\xa3\x8d\x03\x87\xef\xbc\x09\xca\x47\xd5\x0d\x96\x7d\xbe\x3b\x77\x1d\xc5\x68\xce\x3d\x8c\xa5\x5e\xa3\x63\xe7\xc8\x0f\x30\x1c\xe0\x38\x10\xac\x37\x1c\x9c\x1a\xd3\xa2\xa8\x1a\x59\xa3\x29\x1e\x2a\x89\x5f\xdc\x7e\xb8\xe1\x22\x8a\xb2\x44\xbc\x31\x0f\xcc\x3d\x29\xbf\x18\x4d\xae\x66\x25\x7f\xf9\xf1\xa6\x26\xc7\x9f\x04\xa3\x6c\x4f\x1a\x33\x90\xf2\x1a\x7c\xa2\xa0\x2e\x47\x13\xd8\xa5\x72\xff\x44\x29\x2b\xd9\x48\x3c\xd6\xdb\xf5\x55\x69\x52\x6c\x77\x2f\x9b\xa7\xa4\xab\x00\xde\x9e\x65\x9d\x1e\x92\x5b\x8d\x65\x82\x97\x4f\x42\x7b\xab\x51\x6c\x66\x7b\x97\x30\xaa\x8f\xb4\x48\x5a\xcd\xf6\x5d\x9e\x4e\x55\xff\xfc\xe3\xb2\xde\xbe\x62\xb5\xad\xda\xf5\x66\x02\x58\x88\x9f\x00\x00\x00\xff\xff\xe4\xf5\x4c\xc4\xfd\x01\x00\x00") func migrations16_ingest_failed_transactionsSqlBytes() ([]byte, error) { return bindataRead( @@ -240,7 +240,7 @@ func migrations16_ingest_failed_transactionsSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/16_ingest_failed_transactions.sql", size: 319, mode: os.FileMode(420), modTime: time.Unix(1550753648, 0)} + info := bindataFileInfo{name: "migrations/16_ingest_failed_transactions.sql", size: 509, mode: os.FileMode(420), modTime: time.Unix(1551188290, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/services/horizon/internal/db2/schema/migrations/16_ingest_failed_transactions.sql b/services/horizon/internal/db2/schema/migrations/16_ingest_failed_transactions.sql index 6f60b8496c..25d82c5e42 100644 --- a/services/horizon/internal/db2/schema/migrations/16_ingest_failed_transactions.sql +++ b/services/horizon/internal/db2/schema/migrations/16_ingest_failed_transactions.sql @@ -5,6 +5,8 @@ ALTER TABLE history_transactions ADD successful boolean; -- +migrate Down --- Remove failed transactions! +-- Remove failed transactions and operations from failed transactions! +DELETE FROM history_operations USING history_transactions + WHERE history_transactions.id = history_operations.transaction_id AND successful = false; DELETE FROM history_transactions WHERE successful = false; ALTER TABLE history_transactions DROP COLUMN successful;