mirror of https://github.com/Squidex/squidex.git
23 changed files with 219 additions and 210 deletions
@ -0,0 +1,16 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace Squidex.Infrastructure.Migrations |
||||
|
{ |
||||
|
public interface IMigrationPath |
||||
|
{ |
||||
|
(int Version, IEnumerable<IMigration> Migrations) GetNext(int version); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,64 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Migrate_01.Migrations; |
||||
|
using Squidex.Infrastructure.Migrations; |
||||
|
|
||||
|
namespace Migrate_01 |
||||
|
{ |
||||
|
public class MigrationMatrix |
||||
|
{ |
||||
|
private readonly IServiceProvider serviceProvider; |
||||
|
|
||||
|
public MigrationMatrix(IServiceProvider serviceProvider) |
||||
|
{ |
||||
|
this.serviceProvider = serviceProvider; |
||||
|
} |
||||
|
|
||||
|
public (int Version, IEnumerable<IMigration> Migrations) MigrationPath(int version) |
||||
|
{ |
||||
|
switch (version) |
||||
|
{ |
||||
|
case 0: |
||||
|
return (4, |
||||
|
new IMigration[] |
||||
|
{ |
||||
|
serviceProvider.GetRequiredService<ConvertEventStore>(), |
||||
|
serviceProvider.GetRequiredService<RebuildSnapshots>(), |
||||
|
serviceProvider.GetRequiredService<AddPatterns>() |
||||
|
}); |
||||
|
case 1: |
||||
|
return (4, |
||||
|
new IMigration[] |
||||
|
{ |
||||
|
serviceProvider.GetRequiredService<ConvertEventStore>(), |
||||
|
serviceProvider.GetRequiredService<AddPatterns>(), |
||||
|
serviceProvider.GetRequiredService<RebuildContentCollections>() |
||||
|
}); |
||||
|
case 2: |
||||
|
return (4, |
||||
|
new IMigration[] |
||||
|
{ |
||||
|
serviceProvider.GetRequiredService<ConvertEventStore>(), |
||||
|
serviceProvider.GetRequiredService<AddPatterns>(), |
||||
|
serviceProvider.GetRequiredService<RebuildContentCollections>() |
||||
|
}); |
||||
|
case 3: |
||||
|
return (4, |
||||
|
new IMigration[] |
||||
|
{ |
||||
|
serviceProvider.GetRequiredService<ConvertEventStore>() |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
return (0, null); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.Reflection; |
||||
|
|
||||
|
namespace Migrate_01 |
||||
|
{ |
||||
|
public static class SquidexMigrations |
||||
|
{ |
||||
|
public static readonly Assembly Assembly = typeof(SquidexMigrations).Assembly; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue