1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 21:38:38 +00:00

Device calibration - Storage migration

This commit is contained in:
Robert 2020-12-08 20:36:43 +01:00
parent 716f115a2d
commit 67451b5867

View File

@ -0,0 +1,27 @@
using Artemis.Storage.Migrations.Interfaces;
using LiteDB;
namespace Artemis.Storage.Migrations
{
public class M9DeviceCalibration : IStorageMigration
{
public int UserVersion => 9;
/// <inheritdoc />
public void Apply(LiteRepository repository)
{
ILiteCollection<BsonDocument> 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);
}
}
}
}