Upgrade v3.0.8 to v4.0 Exception

Tony Sheehy 11 years ago updated by anonymous 9 years ago 3

The following exception is thrown upgrading from v3.0.8.

Unify.Framework.UnifyServiceInitializeException: 'FK_EntityValue_CollectionKey'
is not a constraint.
Could not drop constraint. See previous errors. ---> System.Data.SqlClient.SqlEx
ception: 'FK_EntityValue_CollectionKey' is not a constraint.
Could not drop constraint. See previous errors.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolea
n breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cm
dHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, Tds
ParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName,
Boolean async)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult res
ult, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo
 queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs
, ICompiledSubQuery[] subQueries, Object lastResult)
   at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryI
nfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompile
dSubQuery[] subQueries)
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider
.Execute(Expression query)
   at System.Data.Linq.DataContext.ExecuteCommand(String command, Object[] param
   at Unify.Framework.Data.LinqContextConversionBase`4.SubmitChanges()
   at Unify.Product.IdentityBroker.IdentityBrokerEngine.ClearOldPartitions()
   at Unify.Product.IdentityBroker.IdentityBrokerEngine.Initialize()
   at Unify.Framework.UnifyEngine`1.Initialize()
   --- End of inner exception stack trace ---
   at Unify.Framework.UnifyEngine`1.Initialize()
   at Unify.Service.Connect.Debug.ProgramProxy.Execute()

This is occurring in v4.0.1, adam has tested it in v4.0.0 and this does not occur; however irrespective of the version some Foreign Key constraints are being missed, such as the listed FK_EntityValue_CollectionKey in conjunction with the FK_EntityValue_Entity constraint.

  • v3.0.6 -> v4.0.x

In the v300 section, the EntityValue table is renamed, recreated (missing two FK contraints), and the old one is deleted.

This needs to be fixed, but this was only exacerbated by the 307/308 version being picked up as v3.0.0; the condition for which is defined as:

IF (SELECT COUNT(*) FROM sys.objects WHERE name = 'ChangesSelect') > 0

Conditional was not firing incorrectly in installer; constraints were not being readded after the EntityValue was sp_renamed. Constraints added and additionally missing index added.

Confirmed in latest installer.