3

Resolved

Orchard.Core.Containers update 4 fails on SqlCe

description

Orchard.Core.Containers update 4 fails on SqlCe with error:

2013-12-22 22:07:04,119 [23] Orchard.Data.Migration.DataMigrationManager - Error while running migration version 4 for Containers
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlServerCe.SqlCeException: Alter table only allows columns to be added which can contain null values. The column cannot be added to the table because it does not allow null values.
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 Orchard.Data.Migration.Interpreters.DefaultDataMigrationInterpreter.RunPendingStatements() in c:\dev\Orchard\Development\Code 1.x\src\Orchard\Data\Migration\Interpreters\DefaultDataMigrationInterpreter.cs:line 336
at Orchard.Data.Migration.Interpreters.DefaultDataMigrationInterpreter.Visit(AlterTableCommand command) in c:\dev\Orchard\Development\Code 1.x\src\Orchard\Data\Migration\Interpreters\DefaultDataMigrationInterpreter.cs:line 134
at Orchard.Data.Migration.Interpreters.AbstractDataMigrationInterpreter.Visit(ISchemaBuilderCommand command) in c:\dev\Orchard\Development\Code 1.x\src\Orchard\Data\Migration\Interpreters\AbstractDataMigrationInterpreter.cs:line 17
at Orchard.Data.Migration.Schema.SchemaBuilder.Run(ISchemaBuilderCommand command) in c:\dev\Orchard\Development\Code 1.x\src\Orchard\Data\Migration\Schema\SchemaBuilder.cs:line 58
at Orchard.Data.Migration.Schema.SchemaBuilder.AlterTable(String name, Action`1 table) in c:\dev\Orchard\Development\Code 1.x\src\Orchard\Data\Migration\Schema\SchemaBuilder.cs:line 38
at Orchard.Core.Containers.Migrations.UpdateFrom4() in c:\dev\Orchard\Development\Code 1.x\src\Orchard.Web\Core\Containers\Migrations.cs:line 79
--- 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:\dev\Orchard\Development\Code 1.x\src\Orchard\Data\Migration\DataMigrationManager.cs:line 126


The reason is the missing of default vaule fora non null alter column.
Working Patch attached

file attachments

comments

jao28 wrote Jan 15 at 8:07 PM

This also impacts regular SQL databases and the attached patch fixed my problem also (thanks for the patch).