mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Nuget - Updated packages
Brush properties - Added default values Brush properties - Removed option to always auto-expand groups Layer properties - Remember expanded/collapsed groups Storage - Added migration system Storage - Added migration that removes profiles made in the old layer properties format Layer timeline - Added back zoom functionality
This commit is contained in:
1 parent
221c8bc7e7
commit
dd000e7bed
58 files changed
+329
-188
No files matched your search
@@ -5,6 +5,7 @@
|
||||
<LangVersion>7</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LiteDB" Version="5.0.7" />
|
||||
<PackageReference Include="LiteDB" Version="5.0.8" />
|
||||
<PackageReference Include="Serilog" Version="2.9.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -11,6 +11,7 @@ namespace Artemis.Storage.Entities.Profile
|
||||
Leds = new List<LedEntity>();
|
||||
PropertyEntities = new List<PropertyEntity>();
|
||||
Condition = new List<ProfileConditionEntity>();
|
||||
ExpandedPropertyGroups = new List<string>();
|
||||
}
|
||||
|
||||
public Guid Id { get; set; }
|
||||
@@ -22,6 +23,7 @@ namespace Artemis.Storage.Entities.Profile
|
||||
public List<LedEntity> Leds { get; set; }
|
||||
public List<PropertyEntity> PropertyEntities { get; set; }
|
||||
public List<ProfileConditionEntity> Condition { get; set; }
|
||||
public List<string> ExpandedPropertyGroups { get; set; }
|
||||
|
||||
[BsonRef("ProfileEntity")]
|
||||
public ProfileEntity Profile { get; set; }
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Migrations.Interfaces;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
public class AttributeBasedPropertiesMigration : IStorageMigration
|
||||
{
|
||||
public int UserVersion => 1;
|
||||
public void Apply(LiteRepository repository)
|
||||
{
|
||||
if (repository.Database.CollectionExists("ProfileEntity"))
|
||||
repository.Database.DropCollection("ProfileEntity");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Migrations.Interfaces
|
||||
{
|
||||
public interface IStorageMigration
|
||||
{
|
||||
int UserVersion { get; }
|
||||
void Apply(LiteRepository repository);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Storage.Migrations.Interfaces;
|
||||
using LiteDB;
|
||||
using Serilog;
|
||||
|
||||
namespace Artemis.Storage
|
||||
{
|
||||
public class StorageMigrationService
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly LiteRepository _repository;
|
||||
private readonly List<IStorageMigration> _migrations;
|
||||
|
||||
public StorageMigrationService(ILogger logger, LiteRepository repository, List<IStorageMigration> migrations)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
_migrations = migrations;
|
||||
|
||||
ApplyPendingMigrations();
|
||||
}
|
||||
|
||||
public void ApplyPendingMigrations()
|
||||
{
|
||||
foreach (var storageMigration in _migrations.OrderBy(m => m.UserVersion))
|
||||
{
|
||||
if (_repository.Database.UserVersion >= storageMigration.UserVersion)
|
||||
continue;
|
||||
|
||||
_logger.Information("Applying storage migration {storageMigration} to update DB from v{oldVersion} to v{newVersion}",
|
||||
storageMigration.GetType().Name, _repository.Database.UserVersion, storageMigration.UserVersion);
|
||||
storageMigration.Apply(_repository);
|
||||
_repository.Database.UserVersion = storageMigration.UserVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user