123456789101112131415161718192021222324252627282930313233343536373839 |
- using InABox.Configuration;
- using InABox.Core;
- using InABox.Database;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PRS.Shared
- {
- public class Update_7_43 : DatabaseUpdateScript
- {
- public override VersionNumber Version => new VersionNumber(7, 43);
- public override bool Update()
- {
- var filters = DbFactory.Provider.Query(
- new InABox.Core.Filter<GlobalSettings>(x => x.Section).IsEqualTo("CoreFilterDefinitions"),
- new InABox.Core.Columns<GlobalSettings>(x => x.ID, x => x.Contents)).ToObjects<GlobalSettings>().ToList();
- foreach(var filter in filters)
- {
- var defs = Serialization.Deserialize<CoreFilterDefinitions>(filter.Contents) ?? new CoreFilterDefinitions();
- var nextSequence = 0L;
- foreach(var def in defs)
- {
- if(def.Sequence < nextSequence)
- {
- def.Sequence = nextSequence;
- }
- nextSequence = def.Sequence + 1;
- }
- filter.Contents = Serialization.Serialize(defs);
- }
- DbFactory.Provider.Save(filters);
- return true;
- }
- }
- }
|