]> git.ipfire.org Git - location/libloc.git/commitdiff
importer: Currently update the source when encountering a conflict
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 12 Mar 2024 11:14:13 +0000 (11:14 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 12 Mar 2024 11:14:13 +0000 (11:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/location-importer.in

index d455764f64a8a7f39f4ce49cc32b25363432ce90..49e914c81720ef79b6477ae70ba96bf8abbd1ad4 100644 (file)
@@ -1328,9 +1328,14 @@ class CLI(object):
                        (
                                %s, %s, %s
                        )
-                       ON CONFLICT (network) DO
-                               UPDATE SET url = excluded.url""",
-                       "%s" % single_network, url, source,
+                       ON CONFLICT
+                       (
+                               network
+                       )
+                       DO UPDATE SET
+                               url = excluded.url,
+                               source = excluded.source
+                       """, "%s" % single_network, url, source,
                )
 
        def _parse_org_block(self, block, source_key):
@@ -2012,6 +2017,13 @@ class CLI(object):
                                                                (
                                                                        %s, %s, %s
                                                                )
+                                                               ON CONFLICT
+                                                               (
+                                                                       network
+                                                               )
+                                                               DO UPDATE SET
+                                                                       url = excluded.url,
+                                                                       source = excluded.source
                                                                """, (("%s" % n, url, "overrides") for n in networks),
                                                        )