Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4860 posts 12127 karma points MVP 3x admin c-trib
    Dec 13, 2017 @ 16:17
    Jeroen Breuer
    0

    Umbraco forms upgrade migration error

    Hello,

    I've upgrade Umbraco forms from v4 to v6. Everything is working, but in the logs I always get this message when the website is restarting:

     2017-12-13 17:09:47,815 [P9440/D5/T17] ERROR Umbraco.Core.Persistence.UmbracoDatabase - Exception (044e68ad).
    System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.cmsMacro' with unique index 'IX_cmsMacroPropertyAlias'. The duplicate key value is (renderUmbracoForm).
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteScalar()
       at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 311
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass11_0.<ExecuteScalarWithRetry>b__0()
       at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
       at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
    ClientConnectionId:a4851da3-81ce-4c0d-af9b-ee3671d13dba
    Error Number:2601,State:1,Class:14
     2017-12-13 17:09:47,821 [P9440/D5/T17] ERROR Umbraco.Forms.Web.Migrations.MigrationEvents - Error running Umbraco Forms migration
    System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.cmsMacro' with unique index 'IX_cmsMacroPropertyAlias'. The duplicate key value is (renderUmbracoForm).
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteScalar()
       at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 311
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass11_0.<ExecuteScalarWithRetry>b__0()
       at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
       at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
       at Umbraco.Core.Persistence.Database.Insert(Object poco)
       at Umbraco.Core.Persistence.Repositories.MacroRepository.PersistNewItem(IMacro entity)
       at Umbraco.Core.Cache.DefaultRepositoryCachePolicy`2.Create(TEntity entity, Action`1 persistNew)
       at Umbraco.Core.Persistence.UnitOfWork.ScopeUnitOfWork.Commit(Action`1 transactionCompleting)
       at Umbraco.Core.Services.MacroService.Save(IMacro macro, Int32 userId)
       at Umbraco.Forms.Web.Migrations.TargetVersionSix.UpdateLegacyMacroAddNewThemeMacro.Up()
       at Umbraco.Core.Persistence.Migrations.MigrationRunner.InitializeMigrations(List`1 migrations, Database database, DatabaseProviders databaseProvider, Boolean isUpgrade)
       at Umbraco.Core.Persistence.Migrations.MigrationRunner.Execute(Database database, DatabaseProviders databaseProvider, Boolean isUpgrade)
       at Umbraco.Forms.Web.Migrations.MigrationEvents.HandleFormsMigrations()
    ClientConnectionId:a4851da3-81ce-4c0d-af9b-ee3671d13dba
    Error Number:2601,State:1,Class:14
    

    Anyone know what could cause this issue and how to fix it?

    Jeroen

  • Warren Buckley 2085 posts 4521 karma points MVP 6x admin hq c-trib
    Dec 13, 2017 @ 16:22
    Warren Buckley
    0

    Hi Jeroen,
    Seems something odd going on with the migration, in theory a migration should only ever run once & not multiple times.

    Is there an entry in the Migration table for Forms?

    Also what Forms macros do you have in the site?

    Thanks,
    Warren :)

  • Jeroen Breuer 4860 posts 12127 karma points MVP 3x admin c-trib
    Dec 13, 2017 @ 16:31
    Jeroen Breuer
    0

    Hi Warren,

    I don't see an entry for Forms in the Migration table. Probably because the migration failed.

    I have the following macro's:

    Insert Form (Legacy)

    Insert Form with Theme

    Render Forms Scripts (Legacy)

    Jeroen

  • Warren Buckley 2085 posts 4521 karma points MVP 6x admin hq c-trib
    Dec 13, 2017 @ 16:35
    Warren Buckley
    0

    Well then the migration seems to have done what it needed to have done, but the first time it was run it seems the entry in the migration was not stored for whatever reason.

    A few other migrations happen for Forms in V6 such as moving the JSON files from AppPlugins to AppData.

    Check that they have moved as well, if so then you should be OK to update/add the entry in manually. Unless there is anything else in the logs that may indicate why the initial migration may have failed & thus store the entry in the DB.

  • Jon 17 posts 127 karma points
    Jun 25, 2018 @ 08:33
    Jon
    0

    Sorry to necro the thread. Having exactly the same issue. My concern is that there has never been an entry in the umbracoMigration for forms, what should it look like?

    Thanks in advance.

  • Luke Maslany 6 posts 74 karma points
    Jul 09, 2019 @ 16:34
    Luke Maslany
    0

    Can I add my own apologies for re-necroing the thread? :)

    I've recently been tasked with the maintenance of an Umbraco instance that is experiencing the same issue.

    Unfortunately for me the migration would have been done some time ago - by someone that no longer works here.

    The site appears to be working as expected but I am concerned that this may adversely affect our ability to upgrade the Umbraco instance in the future.

    The 'umbracoConfigurationStatus' version in the web.config file is showing as version 7.12.1.

    Querying the [umbracoMigration] table in the Umbraco database shows:

    id  name    version createDate
    1   Umbraco 7.5.4   2016-12-06 09:30:48.247
    2   Umbraco 7.5.7   2017-01-16 12:10:28.237
    3   Umbraco 7.9.2   2018-04-26 10:08:46.280
    4   Umbraco 7.12.1  2018-09-06 10:18:04.840
    

    This seems to align with the version information the web.config file.

    Enabling log debugging in Log4Net though shows alternate version numbers:

    DEBUG Umbraco.Forms.Web.Migrations.MigrationEvents - Versions: this=7.0.3, installed=0.0.0
    

    I suspect that this is the reason it keeps trying to run the migration - although I am unsure where the migration tasks are stored.

    Did anyone identify the steps required to resolve this? Be it manually updating/adding the entry; updating source of the version information seen in the debugging log; or the removal of the migration task?

Please Sign in or register to post replies

Write your reply to:

Draft