diff --git a/backend/src/utilities/database.py b/backend/src/utilities/database.py index 6b9cd34..a6d0ef5 100644 --- a/backend/src/utilities/database.py +++ b/backend/src/utilities/database.py @@ -234,6 +234,8 @@ class DatabasePool: ADD COLUMN IF NOT EXISTS capture_observations JSONB """ ) + await conn.execute("DROP INDEX IF EXISTS idx_packets_packet_uid") + await conn.execute("CREATE INDEX IF NOT EXISTS idx_packets_packet_uid ON packets(packet_uid)") logger.info("DB pool initialized") except Exception: logger.exception("Failed to create DB pool") diff --git a/setup_database.sh b/setup_database.sh index 39a45f4..77ba87b 100755 --- a/setup_database.sh +++ b/setup_database.sh @@ -102,7 +102,8 @@ CREATE TABLE IF NOT EXISTS packets ( ); ALTER TABLE packets ADD COLUMN IF NOT EXISTS capture_observations JSONB; CREATE UNIQUE INDEX IF NOT EXISTS idx_packets_correlation_key ON packets(correlation_key); -CREATE UNIQUE INDEX IF NOT EXISTS idx_packets_packet_uid ON packets(packet_uid); +DROP INDEX IF EXISTS idx_packets_packet_uid; +CREATE INDEX IF NOT EXISTS idx_packets_packet_uid ON packets(packet_uid); CREATE INDEX IF NOT EXISTS idx_packets_flow_id ON packets(flow_id); EOF