mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Data model conditions - DRY'd predicate code in preparation for events
This commit is contained in:
1 parent
a79223fa75
commit
574c4b21ec
21 files changed
+510
-918
No files matched your search
@@ -0,0 +1,34 @@
|
||||
using Artemis.Storage.Migrations.Interfaces;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
public class M6PredicateAbstraction : IStorageMigration
|
||||
{
|
||||
public int UserVersion => 7;
|
||||
|
||||
public void Apply(LiteRepository repository)
|
||||
{
|
||||
ILiteCollection<BsonDocument> collection = repository.Database.GetCollection("ProfileEntity");
|
||||
foreach (BsonDocument bsonDocument in collection.FindAll())
|
||||
{
|
||||
|
||||
foreach (BsonValue bsonLayer in bsonDocument["Layers"].AsArray)
|
||||
{
|
||||
bsonLayer["DisplayCondition"] = null;
|
||||
foreach (BsonValue bsonPropertyEntity in bsonLayer["PropertyEntities"].AsArray)
|
||||
bsonPropertyEntity["DataBindingEntities"].AsArray.Clear();
|
||||
}
|
||||
|
||||
foreach (BsonValue bsonLayer in bsonDocument["Folders"].AsArray)
|
||||
{
|
||||
bsonLayer["DisplayCondition"] = null;
|
||||
foreach (BsonValue bsonPropertyEntity in bsonLayer["PropertyEntities"].AsArray)
|
||||
bsonPropertyEntity["DataBindingEntities"].AsArray.Clear();
|
||||
}
|
||||
|
||||
collection.Update(bsonDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user