Add namespace_id as constraints to layer_feature

If layer contains more than one potential namespace, features will be
created for each namespace. Layer_feature table now has to contains one
more constrains (namespace_id).
This commit is contained in:
Ales Raszka 2019-03-06 13:57:11 +01:00
parent 60ef726677
commit 60b0bd27fa
2 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ var (
feature_id INT REFERENCES feature ON DELETE CASCADE, feature_id INT REFERENCES feature ON DELETE CASCADE,
detector_id INT REFERENCES detector ON DELETE CASCADE, detector_id INT REFERENCES detector ON DELETE CASCADE,
namespace_id INT REFERENCES namespace 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 INDEX ON layer_feature(layer_id);`,
`CREATE TABLE IF NOT EXISTS layer_namespace ( `CREATE TABLE IF NOT EXISTS layer_namespace (

View File

@ -121,7 +121,7 @@ func queryPersistFeature(count int) string {
func queryPersistLayerFeature(count int) string { func queryPersistLayerFeature(count int) string {
return queryPersist(count, return queryPersist(count,
"layer_feature", "layer_feature",
"layer_feature_layer_id_feature_id_key", "layer_feature_layer_id_feature_id_namespace_id_key",
"layer_id", "layer_id",
"feature_id", "feature_id",
"detector_id", "detector_id",