diff --git a/pkg/setup/collection.go b/pkg/setup/collection.go index b5dec74a3a2d97924c24d80ebd5d8efad5f1c7e3..cfd6e3f773939e4207a373f41f5f94e93a1a5451 100644 --- a/pkg/setup/collection.go +++ b/pkg/setup/collection.go @@ -76,14 +76,6 @@ func DeleteCollectionIfRemove() CollectionsOption { } func isCollsSchemaMetadataEqual(collection, exist *collections.Collection) bool { - if alwaysSetSchema { - return true - } - - if collection.IsView() && exist.IsView() { - return true - } - if collection.Schema.Metadata == nil && exist.Schema.Metadata == nil { return true } @@ -100,7 +92,7 @@ func isCollsSchemaMetadataEqual(collection, exist *collections.Collection) bool func DefaultUpdateCollectionStrategy() CollectionsOption { return func(c *CollectionConfig) { c.UpdateFn = func(s *Setup, exist, collection *collections.Collection) (*collections.Collection, bool, bool, error) { - if !s.IsForce() && !isCollsSchemaMetadataEqual(collection, exist) { + if !alwaysSetSchema && !s.IsForce() && !collection.IsView() && !exist.IsView() && !isCollsSchemaMetadataEqual(collection, exist) { return nil, false, false, errors.WithDetailf(collections.ErrAlreadyExists, "Коллекция с идентификатором '%s' "+ "уже существует. Удалите ее или вызовите установку расширения с флагом Force", collection.ID) }