forked from owasp-amass/asset-db
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(migrations): add indexes for ip, netblock, rir, and asn assets
Closes: owasp-amass#29
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- +migrate Up | ||
CREATE INDEX IF NOT EXISTS idx_ip_content_address ON assets USING gin ((content->>'address') gin_trgm_ops) WHERE type = 'IPAddress'; | ||
CREATE INDEX IF NOT EXISTS idx_net_content_cidr ON assets USING gin ((content->>'cidr') gin_trgm_ops) WHERE type = 'Netblock'; | ||
CREATE INDEX IF NOT EXISTS idx_rir_content_name ON assets USING gin ((content->>'name') gin_trgm_ops) WHERE type = 'RIROrg'; | ||
CREATE INDEX IF NOT EXISTS idx_asn_content_num ON assets USING gin ((content->>'number') gin_trgm_ops) WHERE type = 'ASN'; | ||
|
||
-- +migrate Down | ||
DROP INDEX IF EXISTS idx_ip_content_address; | ||
DROP INDEX IF EXISTS idx_net_content_cidr; | ||
DROP INDEX IF EXISTS idx_rir_content_name; | ||
DROP INDEX IF EXISTS idx_asn_content_num; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- +migrate Up | ||
CREATE INDEX idx_ip_content_address ON assets (content->>'address' COLLATE NOCASE) WHERE type = 'IPAddress'; | ||
CREATE INDEX idx_net_content_cidr ON assets (content->>'cidr' COLLATE NOCASE) WHERE type = 'Netblock'; | ||
CREATE INDEX idx_rir_content_name ON assets (content->>'name' COLLATE NOCASE) WHERE type = 'RIROrg'; | ||
CREATE INDEX idx_asn_content_num ON assets (content->>'number' COLLATE NOCASE) WHERE type = 'ASN'; | ||
|
||
-- +migrate Down | ||
DROP INDEX IF EXISTS idx_ip_content_address; | ||
DROP INDEX IF EXISTS idx_net_content_cidr; | ||
DROP INDEX IF EXISTS idx_rir_content_name; | ||
DROP INDEX IF EXISTS idx_asn_content_num; |