using Comal.Classes; using InABox.Configuration; using InABox.Core; using InABox.Database; namespace PRS.Shared.Database_Update_Scripts; internal class Update_8_20 : DatabaseUpdateScript { public override VersionNumber Version => new(8, 20); public override bool Update() { var _provider = DbFactory.NewProvider(Logger.Main); MigrateSettings(_provider); MigrateSettings(_provider); return true; } private static void MigrateSettings(IProvider provider) where T : BaseObject, new() { var _table = provider.GetTable(); if (_table != null) { var _entity = _table.Rows.FirstOrDefault()?.ToObject(); if (_entity != null) { var _config = new GlobalSettings() { Section = typeof(T).Name.Split('.').Last(), Key = "", Contents = Serialization.Serialize(_entity) }; provider.Save(_config); } provider.DropTable(); } } }