diff --git a/crates/sui-indexer/migrations/pg/2024-10-30-005153_drop_tx_sender_and_recipient/down.sql b/crates/sui-indexer/migrations/pg/2024-10-30-005153_drop_tx_sender_and_recipient/down.sql new file mode 100644 index 0000000000000..b9fcef3e1f439 --- /dev/null +++ b/crates/sui-indexer/migrations/pg/2024-10-30-005153_drop_tx_sender_and_recipient/down.sql @@ -0,0 +1,18 @@ +CREATE TABLE tx_senders ( + tx_sequence_number BIGINT NOT NULL, + sender BYTEA NOT NULL, + PRIMARY KEY(sender, tx_sequence_number) +); + +CREATE INDEX IF NOT EXISTS tx_senders_tx_sequence_number + ON tx_senders (tx_sequence_number); + +CREATE TABLE tx_recipients ( + tx_sequence_number BIGINT NOT NULL, + recipient BYTEA NOT NULL, + sender BYTEA NOT NULL, + PRIMARY KEY(recipient, tx_sequence_number) +); + +CREATE INDEX IF NOT EXISTS tx_recipients_sender + ON tx_recipients (sender, recipient, tx_sequence_number); diff --git a/crates/sui-indexer/migrations/pg/2024-10-30-005153_drop_tx_sender_and_recipient/up.sql b/crates/sui-indexer/migrations/pg/2024-10-30-005153_drop_tx_sender_and_recipient/up.sql new file mode 100644 index 0000000000000..fb259ea615d84 --- /dev/null +++ b/crates/sui-indexer/migrations/pg/2024-10-30-005153_drop_tx_sender_and_recipient/up.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS tx_senders; +DROP TABLE IF EXISTS tx_recipients; diff --git a/crates/sui-indexer/src/schema.rs b/crates/sui-indexer/src/schema.rs index aceb54597c9c5..447b45557922c 100644 --- a/crates/sui-indexer/src/schema.rs +++ b/crates/sui-indexer/src/schema.rs @@ -354,21 +354,6 @@ diesel::table! { } } -diesel::table! { - tx_recipients (recipient, tx_sequence_number) { - tx_sequence_number -> Int8, - recipient -> Bytea, - sender -> Bytea, - } -} - -diesel::table! { - tx_senders (sender, tx_sequence_number) { - tx_sequence_number -> Int8, - sender -> Bytea, - } -} - diesel::table! { watermarks (pipeline) { pipeline -> Text, @@ -415,7 +400,5 @@ diesel::allow_tables_to_appear_in_same_query!( tx_digests, tx_input_objects, tx_kinds, - tx_recipients, - tx_senders, watermarks, );