From 2b96ed279a192614808142a7c9ef819a52acd517 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 12 Mar 2024 11:17:50 +0000 Subject: [PATCH] importer: Allow storing multiple Geofeeds for the same network This is very likely not required except for a couple of overrides. Signed-off-by: Michael Tremer --- src/scripts/location-importer.in | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in index 49e914c..5424b5c 100644 --- a/src/scripts/location-importer.in +++ b/src/scripts/location-importer.in @@ -241,12 +241,13 @@ class CLI(object): ON geofeed_networks USING GIST(network inet_ops); CREATE TABLE IF NOT EXISTS network_geofeeds(network inet, url text); ALTER TABLE network_geofeeds ADD COLUMN IF NOT EXISTS source text NOT NULL; - CREATE UNIQUE INDEX IF NOT EXISTS network_geofeeds_unique - ON network_geofeeds(network); + CREATE UNIQUE INDEX IF NOT EXISTS network_geofeeds_unique2 + ON network_geofeeds(network, url); CREATE INDEX IF NOT EXISTS network_geofeeds_search ON network_geofeeds USING GIST(network inet_ops); CREATE INDEX IF NOT EXISTS network_geofeeds_url ON network_geofeeds(url); + DROP INDEX IF EXISTS network_geofeeds_unique; -- feeds CREATE TABLE IF NOT EXISTS autnum_feeds( @@ -1330,10 +1331,9 @@ class CLI(object): ) ON CONFLICT ( - network + network, url ) DO UPDATE SET - url = excluded.url, source = excluded.source """, "%s" % single_network, url, source, ) @@ -2019,10 +2019,9 @@ class CLI(object): ) ON CONFLICT ( - network + network, url ) DO UPDATE SET - url = excluded.url, source = excluded.source """, (("%s" % n, url, "overrides") for n in networks), ) -- 2.39.5