2

Closed

Error updating Taxonomies

description

After updating to Rev 7130, Orchard showed a notice indicating that Orchard.Taxonomies needed to be upgraded. Clicking on the Update link results in a message that the module was updated successfully, however, the notice indicating that Orchard.Taxonomies needs to be upgraded remains. Subsequent clicks on the Update link result in the same. Checked the log file and found the following which seems to indicate a SQL error, possibly specific to CE. I checked my Orchard_Taxonomies_TaxonomyPartRecord table and there is only 1 row in the table. It has an ID of 22:

2013-06-19 14:39:42,296 [13] Orchard.Data.Migration.DataMigrationManager - Error while running migration version 2 for Orchard.Taxonomies
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.Exceptions.GenericADOException: could not execute native bulk manipulation query:alter table "Orchard_Taxonomies_TaxonomyPartRecord" add "IsInternal" BIT null[SQL: alter table "Orchard_Taxonomies_TaxonomyPartRecord" add "IsInternal" BIT null] ---> System.Data.SqlServerCe.SqlCeException: A column ID occurred more than once in the specification.
at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.Engine.Query.NativeSQLQueryPlan.PerformExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session)
--- End of inner exception stack trace ---
at NHibernate.Engine.Query.NativeSQLQueryPlan.PerformExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.ExecuteNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification, QueryParameters queryParameters)
at NHibernate.Impl.SqlQueryImpl.ExecuteUpdate()
at Orchard.Data.Migration.Interpreters.DefaultDataMigrationInterpreter.RunPendingStatements() in c:\Users\philipsenechal\Documents\Development\src\Orchard\Data\Migration\Interpreters\DefaultDataMigrationInterpreter.cs:line 334
at Orchard.Data.Migration.Interpreters.DefaultDataMigrationInterpreter.Visit(AlterTableCommand command) in c:\Users\philipsenechal\Documents\Development\src\Orchard\Data\Migration\Interpreters\DefaultDataMigrationInterpreter.cs:line 134
at Orchard.Data.Migration.Interpreters.AbstractDataMigrationInterpreter.Visit(ISchemaBuilderCommand command) in c:\Users\philipsenechal\Documents\Development\src\Orchard\Data\Migration\Interpreters\AbstractDataMigrationInterpreter.cs:line 17
at Orchard.Data.Migration.Schema.SchemaBuilder.Run(ISchemaBuilderCommand command) in c:\Users\philipsenechal\Documents\Development\src\Orchard\Data\Migration\Schema\SchemaBuilder.cs:line 58
at Orchard.Data.Migration.Schema.SchemaBuilder.AlterTable(String name, Action`1 table) in c:\Users\philipsenechal\Documents\Development\src\Orchard\Data\Migration\Schema\SchemaBuilder.cs:line 38
at Orchard.Taxonomies.Migrations.UpdateFrom2() in c:\Users\philipsenechal\Documents\Development\src\Orchard.Web\Modules\Orchard.Taxonomies\Migrations.cs:line 90
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Orchard.Data.Migration.DataMigrationManager.Update(String feature) in c:\Users\philipsenechal\Documents\Development\src\Orchard\Data\Migration\DataMigrationManager.cs:line 115
Closed Jun 26, 2013 at 7:53 PM by sebastienros
In ed73a2ac78d2

comments

psenechal wrote Jun 20, 2013 at 5:05 PM

As a follow up, it doesn't appear to just be Taxonomies. It looks like all migration updates are currently failing. I have a theme with an initial migration to create a table and it is failing.

CSADNT wrote Jun 20, 2013 at 5:09 PM

I was here before :)
https://orchard.codeplex.com/workitem/19813

Just add a try catch arround the last migration, expecting something better :) later
    public int UpdateFrom2() {
        try
        {
            SchemaBuilder.AlterTable("TaxonomyPartRecord", table => table.AddColumn<bool>("IsInternal"));
        }
        catch { }
        return 3;
    }
}

CSADNT wrote Jun 20, 2013 at 5:15 PM

Seems you reported before :), well, this one could be closed.

CSADNT wrote Jun 20, 2013 at 5:40 PM

Not this one, mine.... may be one day we will be authorized to modify our answ'ers here as in the discussions....