Skip to content

Commit 36dee90

Browse files
Merge pull request #269 from felladaniel36-hash/#238-Add-automated-data-archiving-for-historical-subscription-events-to-maintain-database-query-performance-FIXED
ISSUE #238 FIXED
2 parents 5f680cf + a52bd79 commit 36dee90

7 files changed

Lines changed: 2897 additions & 0 deletions
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Migration: Create soroban_events_archive table for automated data archiving
3+
* Issue: Add automated data archiving for historical subscription events to maintain database query performance
4+
* Focus Area: Backend Reliability, Security Hardening, and Soroban Integration Optimization
5+
*/
6+
7+
CREATE TABLE IF NOT EXISTS soroban_events_archive (
8+
id TEXT PRIMARY KEY,
9+
contract_id TEXT NOT NULL,
10+
transaction_hash TEXT NOT NULL,
11+
event_index INTEGER NOT NULL,
12+
ledger_sequence INTEGER NOT NULL,
13+
event_type TEXT NOT NULL,
14+
event_data TEXT NOT NULL,
15+
raw_xdr TEXT,
16+
ledger_timestamp TEXT NOT NULL,
17+
ingested_at TEXT NOT NULL,
18+
processed_at TEXT,
19+
status TEXT NOT NULL,
20+
error_message TEXT,
21+
retry_count INTEGER NOT NULL DEFAULT 0,
22+
archived_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
23+
);
24+
25+
CREATE INDEX IF NOT EXISTS idx_soroban_archive_contract_id ON soroban_events_archive (contract_id);
26+
CREATE INDEX IF NOT EXISTS idx_soroban_archive_ledger_timestamp ON soroban_events_archive (ledger_timestamp);
27+
CREATE INDEX IF NOT EXISTS idx_soroban_archive_event_type ON soroban_events_archive (event_type);
28+
CREATE INDEX IF NOT EXISTS idx_soroban_archive_archived_at ON soroban_events_archive (archived_at);

0 commit comments

Comments
 (0)