Skip to content

Commit ad1f276

Browse files
authored
Remove UNIQUE constraints – those should be tracked by the node anyway (#4852)
## Motivation We saw UNIQUE constraints violations for the `operations` table when testing w/ the exporter. ## Proposal Remove all constraints – those should be maintained by the node anyway and add additional work for the SQlite (that has to check them). ## Test Plan manual. ## Release Plan - Nothing to do / These changes follow the usual release cycle.## Links - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1 parent ffcb6b7 commit ad1f276

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

linera-indexer/lib/src/db/sqlite/consts.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ CREATE TABLE IF NOT EXISTS operations (
4848
authenticated_owner TEXT,
4949
data BLOB NOT NULL, -- Serialized operation
5050
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
51-
FOREIGN KEY (block_hash) REFERENCES blocks(hash),
52-
UNIQUE(block_hash, operation_index)
51+
FOREIGN KEY (block_hash) REFERENCES blocks(hash)
5352
);
5453
5554
CREATE INDEX IF NOT EXISTS idx_operations_block_hash ON operations(block_hash);
@@ -79,8 +78,7 @@ CREATE TABLE IF NOT EXISTS outgoing_messages (
7978
system_recipient TEXT, -- Withdraw recipient
8079
data BLOB NOT NULL, -- Serialized message content
8180
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
82-
FOREIGN KEY (block_hash) REFERENCES blocks(hash),
83-
UNIQUE(block_hash, transaction_index, message_index)
81+
FOREIGN KEY (block_hash) REFERENCES blocks(hash)
8482
);
8583
8684
CREATE INDEX IF NOT EXISTS idx_outgoing_messages_block_hash ON outgoing_messages(block_hash);
@@ -101,8 +99,7 @@ CREATE TABLE IF NOT EXISTS events (
10199
stream_index INTEGER NOT NULL,
102100
data BLOB NOT NULL, -- Event payload
103101
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
104-
FOREIGN KEY (block_hash) REFERENCES blocks(hash),
105-
UNIQUE(block_hash, transaction_index, event_index)
102+
FOREIGN KEY (block_hash) REFERENCES blocks(hash)
106103
);
107104
108105
CREATE INDEX IF NOT EXISTS idx_events_block_hash ON events(block_hash);
@@ -120,8 +117,7 @@ CREATE TABLE IF NOT EXISTS oracle_responses (
120117
blob_hash TEXT, -- For blob responses
121118
data BLOB, -- For service responses
122119
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
123-
FOREIGN KEY (block_hash) REFERENCES blocks(hash),
124-
UNIQUE(block_hash, transaction_index, response_index)
120+
FOREIGN KEY (block_hash) REFERENCES blocks(hash)
125121
);
126122
127123
CREATE INDEX IF NOT EXISTS idx_oracle_responses_block_hash ON oracle_responses(block_hash);

0 commit comments

Comments
 (0)