Fixes: U4-7370 Upgrading from 7.3.1 to 7.4 fails
cherrypicked from 7.4.0 branch. Added migration for 7.3.2, ensuring the identity on the table is correct. It failed due to rows initially being inserted with identity disabled and therefore the seed of the table was zero even when the table had data.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeTwo
|
||||
{
|
||||
/// <summary>
|
||||
/// This reinserts all migrations in the migrations table to account for initial rows inserted
|
||||
/// on creation without identity enabled.
|
||||
/// </summary>
|
||||
[Migration("7.3.2", 0, GlobalSettings.UmbracoMigrationName)]
|
||||
public class EnsureMigrationsTableIdentityIsCorrect : MigrationBase
|
||||
{
|
||||
public EnsureMigrationsTableIdentityIsCorrect(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
Delete.FromTable("umbracoMigration").AllRows();
|
||||
var migrations = Context.Database.Fetch<MigrationDto>(new Sql().Select("*").From<MigrationDto>(SqlSyntax));
|
||||
foreach (var migration in migrations)
|
||||
{
|
||||
Insert.IntoTable("umbracoMigration")
|
||||
.Row(new {name = migration.Name, createDate = migration.CreateDate, version = migration.Version});
|
||||
}
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
//If there's a GetAll zero count cache, ensure it is cleared
|
||||
RuntimeCache.ClearCacheItem(GetCacheTypeKey<TEntity>());
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
//if an exception is thrown we need to remove the entry from cache, this is ONLY a work around because of the way
|
||||
// that we cache entities: http://issues.umbraco.org/issue/U4-4259
|
||||
|
||||
@@ -404,6 +404,7 @@
|
||||
<Compile Include="Persistence\Mappers\AccessMapper.cs" />
|
||||
<Compile Include="Persistence\Mappers\DomainMapper.cs" />
|
||||
<Compile Include="Persistence\Mappers\MigrationEntryMapper.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeTwo\EnsureMigrationsTableIdentityIsCorrect.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddExternalLoginsTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddForeignKeysForLanguageAndDictionaryTables.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddServerRegistrationColumnsAndLock.cs" />
|
||||
|
||||
Reference in New Issue
Block a user