Skip to content
Snippets Groups Projects
Commit 4d9f1028 authored by Pavel Antonov's avatar Pavel Antonov :asterisk:
Browse files

Merge branch 'feature/PRXS-1628-OverwriteCollection' into 'master'

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

See merge request perxis/perxis-go!92
parents cdfe0757 74e5bc5b
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,10 @@ func NewCollectionConfig(collection *collections.Collection, opt ...CollectionsO
func OverwriteCollection() CollectionsOption {
return func(c *CollectionConfig) {
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.
Finish editing this message first!
Please register or to comment