diff --git a/database/pgsql/migrations/00001_initial_schema.go b/database/pgsql/migrations/00001_initial_schema.go index 85b2b49c..180a1a15 100644 --- a/database/pgsql/migrations/00001_initial_schema.go +++ b/database/pgsql/migrations/00001_initial_schema.go @@ -90,7 +90,7 @@ var ( feature_id INT REFERENCES feature ON DELETE CASCADE, detector_id INT REFERENCES detector ON DELETE CASCADE, namespace_id INT REFERENCES namespace ON DELETE CASCADE, - UNIQUE (layer_id, feature_id));`, + UNIQUE (layer_id, feature_id, namespace_id));`, `CREATE INDEX ON layer_feature(layer_id);`, `CREATE TABLE IF NOT EXISTS layer_namespace ( diff --git a/database/pgsql/queries.go b/database/pgsql/queries.go index 111dc30e..e19f466a 100644 --- a/database/pgsql/queries.go +++ b/database/pgsql/queries.go @@ -121,7 +121,7 @@ func queryPersistFeature(count int) string { func queryPersistLayerFeature(count int) string { return queryPersist(count, "layer_feature", - "layer_feature_layer_id_feature_id_key", + "layer_feature_layer_id_feature_id_namespace_id_key", "layer_id", "feature_id", "detector_id",