Upgrading Error: ... is not a constraint. Could not drop constraint.

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
2/28/2012 6:13:30 AM
Gravatar
Total Posts 68

Upgrading Error: ... is not a constraint. Could not drop constraint.

Hi,

I did an upgrade from Mojo version 2.3.1.9 to the 2.3.8.1 on Windows Server 2003 and MS SQL 2000 which was upgraded to MS SQL 2008.

I imported the tables from the old SQL 2000 database into the new SQL 2008 database.

Then copied all the files from the Mojo zip file and made the change in the user.config file to point to the new database.

Then ran the setup/default.aspx and I get this error.

Probing system...
File system permissions ok.
MSSQL database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema needs upgrade.
28 site(s) found.
Running script mojoportal-core - 2.3.4.6 - 00:00:00.0625008
System.Data.SqlClient.SqlException (0x80131904): 'DF_mp_LetterInfo_AvailableToRoles' is not a constraint. Could not drop constraint. See previous errors. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at mojoPortal.Data.SqlHelper.ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, String commandText, Int32 commandTimeout, SqlParameter[] commandParameters) at mojoPortal.Data.DBPortal.DatabaseHelperRunScript(String script, String overrideConnectionInfo) at mojoPortal.Data.DBPortal.DatabaseHelperRunScript(FileInfo scriptFile, String overrideConnectionInfo) at mojoPortal.Business.DatabaseHelper.RunScript(Guid applicationId, FileInfo scriptFile, String overrideConnectionInfo) - 00:00:00.2500032

Please help as my live sites are all down now.

2/28/2012 6:31:34 AM
Gravatar
Total Posts 18439

Re: Upgrading Error: ... is not a constraint. Could not drop constraint.

Hi,

I imported the tables from the old SQL 2000 database into the new SQL 2008 database.

That does not work as you have found it causes the loss of primary keys, forteign keys, default values and other problems. Importing objects from one db to another is the wrong way to do it.

The only correct way to do it is to make a database backup on sql 2000 and then restore it on sql 2008, or use a tool such as Red Gate Sql bundle or this free tool to script off the structure and data correctly into a script that you can run on the new db.

Hope that helps,

Joe

3/1/2012 12:11:08 AM
Gravatar
Total Posts 68

Re: Upgrading Error: ... is not a constraint. Could not drop constraint.

Thanks Joe. I did the restore of the database and now the site are running beautifully!

Three cheers for MojoPortal!

You must sign in to post in the forums. This thread is closed to new posts.