diff pkg/imports/dmv.go @ 2380:5f300bd7316f

Do not delete distance marks on import Deleting a distance mark will fail if other objects (e.g. waterway profiles) depend on it. Since the following INSERT is actually an 'UPSERT', existing distance marks will be updated anyhow. Deletion of distance marks that have been removed from the RIS-Index still has to be implemented.
author Tom Gottfried <tom@intevation.de>
date Fri, 22 Feb 2019 15:15:23 +0100
parents 7c83b5277c1c
children eb1d119f253f
line wrap: on
line diff
--- a/pkg/imports/dmv.go	Fri Feb 22 14:33:33 2019 +0100
+++ b/pkg/imports/dmv.go	Fri Feb 22 15:15:23 2019 +0100
@@ -66,10 +66,6 @@
 func (*DistanceMarksVirtual) CleanUp() error { return nil }
 
 const (
-	deleteDistanceMarksVirtualSQL = `
-DELETE FROM waterway.distance_marks_virtual
-WHERE (location_code).country_code = $1
-`
 	insertDistanceMarksVirtualSQL = `
 INSERT INTO waterway.distance_marks_virtual (
   location_code,
@@ -137,10 +133,6 @@
 		return nil, fmt.Errorf("Error requesting ERDMS service: %v", err)
 	}
 
-	if _, err := tx.ExecContext(ctx, deleteDistanceMarksVirtualSQL, country); err != nil {
-		return nil, err
-	}
-
 	insertStmt, err := tx.PrepareContext(ctx, insertDistanceMarksVirtualSQL)
 	if err != nil {
 		return nil, err