Skip to content
Snippets Groups Projects
Commit 74e5bc5b authored by Anton Sattarov's avatar Anton Sattarov
Browse files

Изменена библиотечная функция OverwriteCollection - коллекция и схема...

Изменена библиотечная функция OverwriteCollection - коллекция и схема обновляется только если в них есть изменения
parent cdfe0757
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,10 @@ func NewCollectionConfig(collection *collections.Collection, opt ...CollectionsO ...@@ -45,7 +45,10 @@ func NewCollectionConfig(collection *collections.Collection, opt ...CollectionsO
func OverwriteCollection() CollectionsOption { func OverwriteCollection() CollectionsOption {
return func(c *CollectionConfig) { return func(c *CollectionConfig) {
c.UpdateFn = func(s *Setup, old, new *collections.Collection) (*collections.Collection, bool, bool, error) { c.UpdateFn = func(s *Setup, old, new *collections.Collection) (*collections.Collection, bool, bool, error) {
return new, true, true, nil update := new.Name != old.Name || new.IsSingle() != old.IsSingle() || new.IsSystem() != old.IsSystem() ||
new.IsNoData() != old.IsNoData() || new.Hidden != old.Hidden || new.IsView() != old.IsView() || !data.ElementsMatch(old.Tags, new.Tags)
return new, update, !reflect.DeepEqual(old.Schema, new.Schema), nil
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment