diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeTwo/EnsureMigrationsTableIdentityIsCorrect.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeTwo/EnsureMigrationsTableIdentityIsCorrect.cs new file mode 100644 index 0000000000..ce70cdc407 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeTwo/EnsureMigrationsTableIdentityIsCorrect.cs @@ -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 +{ + /// + /// This reinserts all migrations in the migrations table to account for initial rows inserted + /// on creation without identity enabled. + /// + [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(new Sql().Select("*").From(SqlSyntax)); + foreach (var migration in migrations) + { + Insert.IntoTable("umbracoMigration") + .Row(new {name = migration.Name, createDate = migration.CreateDate, version = migration.Version}); + } + } + + public override void Down() + { + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/RepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/RepositoryBase.cs index f9088e1911..124aaeb035 100644 --- a/src/Umbraco.Core/Persistence/Repositories/RepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/RepositoryBase.cs @@ -297,7 +297,7 @@ namespace Umbraco.Core.Persistence.Repositories //If there's a GetAll zero count cache, ensure it is cleared RuntimeCache.ClearCacheItem(GetCacheTypeKey()); } - 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 diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 19e1d3e41e..f8cdcb10c2 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -404,6 +404,7 @@ +