diff --git a/src/Artemis.Storage/Migrations/M9DeviceCalibration.cs b/src/Artemis.Storage/Migrations/M9DeviceCalibration.cs new file mode 100644 index 000000000..3132f8b7f --- /dev/null +++ b/src/Artemis.Storage/Migrations/M9DeviceCalibration.cs @@ -0,0 +1,27 @@ +using Artemis.Storage.Migrations.Interfaces; +using LiteDB; + +namespace Artemis.Storage.Migrations +{ + public class M9DeviceCalibration : IStorageMigration + { + public int UserVersion => 9; + + /// + public void Apply(LiteRepository repository) + { + ILiteCollection collection = repository.Database.GetCollection("SurfaceEntity"); + foreach (BsonDocument bsonDocument in collection.FindAll()) + { + foreach (BsonValue bsonDevice in bsonDocument["DeviceEntities"].AsArray) + { + bsonDevice["RedScale"] = 1; + bsonDevice["GreenScale"] = 1; + bsonDevice["BlueScale"] = 1; + } + + collection.Update(bsonDocument); + } + } + } +} \ No newline at end of file