remove migration code

This commit is contained in:
Infi
2024-04-18 12:11:55 +02:00
parent 79488fdaab
commit e7ca4ee6a6
2 changed files with 15 additions and 38 deletions
-3
View File
@@ -56,8 +56,6 @@ internal class Configuration : IPluginConfiguration
public bool OverrideStyle; public bool OverrideStyle;
public string? ChosenStyle; public string? ChosenStyle;
public uint DatabaseMigration = LatestDbVersion;
internal void UpdateFrom(Configuration other) internal void UpdateFrom(Configuration other)
{ {
HideChat = other.HideChat; HideChat = other.HideChat;
@@ -96,7 +94,6 @@ internal class Configuration : IPluginConfiguration
WindowAlpha = other.WindowAlpha; WindowAlpha = other.WindowAlpha;
ChatColours = other.ChatColours.ToDictionary(entry => entry.Key, entry => entry.Value); ChatColours = other.ChatColours.ToDictionary(entry => entry.Key, entry => entry.Value);
Tabs = other.Tabs.Select(t => t.Clone()).ToList(); Tabs = other.Tabs.Select(t => t.Clone()).ToList();
DatabaseMigration = other.DatabaseMigration;
OverrideStyle = other.OverrideStyle; OverrideStyle = other.OverrideStyle;
ChosenStyle = other.ChosenStyle; ChosenStyle = other.ChosenStyle;
} }
+15 -35
View File
@@ -45,41 +45,21 @@ internal class Store : IDisposable
// EnumAsInteger = true, // EnumAsInteger = true,
}; };
if (Plugin.Config.DatabaseMigration == 0) BsonMapper.Global.Entity<Message>()
{ .Id(msg => msg.Id)
BsonMapper.Global.Entity<Message>() .Ctor(doc => new Message(
.Id(msg => msg.Id) doc["_id"].AsObjectId,
.Ctor(doc => new Message( (ulong) doc["Receiver"].AsInt64,
doc["_id"].AsObjectId, (ulong) doc["ContentId"].AsInt64,
(ulong) doc["Receiver"].AsInt64, DateTime.UnixEpoch.AddMilliseconds(doc["Date"].AsInt64),
(ulong) doc["ContentId"].AsInt64, doc["Code"].AsDocument,
DateTime.UnixEpoch.AddMilliseconds(doc["Date"].AsInt64), doc["Sender"].AsArray,
doc["Code"].AsDocument, doc["Content"].AsArray,
doc["Sender"].AsArray, doc["SenderSource"],
doc["Content"].AsArray, doc["ContentSource"],
doc["SenderSource"], doc["SortCode"].AsDocument,
doc["ContentSource"], doc["ExtraChatChannel"]
doc["SortCode"].AsDocument ));
));
}
else
{
BsonMapper.Global.Entity<Message>()
.Id(msg => msg.Id)
.Ctor(doc => new Message(
doc["_id"].AsObjectId,
(ulong) doc["Receiver"].AsInt64,
(ulong) doc["ContentId"].AsInt64,
DateTime.UnixEpoch.AddMilliseconds(doc["Date"].AsInt64),
doc["Code"].AsDocument,
doc["Sender"].AsArray,
doc["Content"].AsArray,
doc["SenderSource"],
doc["ContentSource"],
doc["SortCode"].AsDocument,
doc["ExtraChatChannel"]
));
}
BsonMapper.Global.RegisterType<Payload?>( BsonMapper.Global.RegisterType<Payload?>(
payload => payload =>