Version 4.3 to 4.4 Fails with Database Error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 anno tempo fa
After converting v4.2 to v4.3, when I try to go to v4.4 I get the following exceptions.

System.Exception: An error occured executing the following sql:
CREATE TABLE [dbo].[AddressAttribute] ([Id] INT NOT NULL IDENTITY(1,1), [Name] NVARCHAR(400) NOT NULL, [IsRequired] BIT NOT NULL, [AttributeControlTypeId] INT NOT NULL, [DisplayOrder] INT NOT NULL, CONSTRAINT [PK_AddressAttribute] PRIMARY KEY ([Id]))
The error was There is already an object named 'AddressAttribute' in the database.

This occurs for other tables too.

Interesting that in v4.3 when I try to install plugins (7Spikes, Pickup In Store, and others) I get the same exception.

So I'm stuck on v4.2 until I can get this resolved (I need 7Spikes). Any help would be most appreciated.

Thanks - Mark.
1 anno tempo fa
Hello Mark,

Are you executed 4.30 upgrade script?
1 anno tempo fa
Yes. Here is the process I went through.

1. Copied v4.2 database to a "v4.3" database.
2. Ran the update script on my v4.3 database.
3. Noticed the new migration table in the v4.3 database.
4. Tested nop4.3 using VS2022. Everything fine (no plugins).
5. Tested nop4.3 NoSource. Everything fine (no plugins).
6. Tried nop4.4 Source with VS2022. Got the exception.
7. Tried nop4.4 NoSource and got an IIS failure message.
8. Tried to install 7Spikes plugin in v4.3 and got the exception.
1 anno tempo fa
Hi for nopCommerce 4.4 there is no Upgrade scripts are exist ,

you need to RUN the project it will automatic migrate with database , for existing DB if using plugin you need to update the plugin with migrate or you can add table into Database
1 anno tempo fa
Correct, for the v4.3 upgrade I ran the script but with v4.4 I ran nopCommerce directly against the v4.3 database (steps 6 and 7 above).
1 anno tempo fa
Here's a picture of the exception and the exception details.



System.Exception
  HResult=0x80131500
  Message=An error occured executing the following sql:
CREATE TABLE [dbo].[AddressAttribute] ([Id] INT NOT NULL IDENTITY(1,1), [Name] NVARCHAR(400) NOT NULL, [IsRequired] BIT NOT NULL, [AttributeControlTypeId] INT NOT NULL, [DisplayOrder] INT NOT NULL, CONSTRAINT [PK_AddressAttribute] PRIMARY KEY ([Id]))
The error was There is already an object named 'AddressAttribute' in the database.

  Source=FluentMigrator.Runner.Core
  StackTrace:
   at FluentMigrator.Runner.Processors.ProcessorBase.ReThrowWithSql(Exception ex, String sql)
   at FluentMigrator.Runner.Processors.SqlServer.SqlServerProcessor.ExecuteNonQuery(String sql)
   at FluentMigrator.Runner.Processors.SqlServer.SqlServerProcessor.Process(String sql)
   at FluentMigrator.Runner.Processors.ProcessorBase.Process(CreateTableExpression expression)
   at FluentMigrator.Expressions.CreateTableExpression.ExecuteWith(IMigrationProcessor processor)
   at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.<ExecuteExpressions>b__1()
   at FluentMigrator.Runner.StopWatch.Time(Action action)
   at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection`1 expressions)
   at FluentMigrator.Runner.MigrationRunner.ExecuteMigration(IMigration migration, Action`2 getExpressions)
   at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction)
   at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion, Boolean useAutomaticTransactionManagement)
   at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion)
   at Nop.Data.Migrations.MigrationManager.ApplyUpMigrations(Assembly assembly, Boolean isUpdateProcess) in C:\Development\BlueFire\nopCommerce_4.40_Source\src\Libraries\Nop.Data\Migrations\MigrationManager.cs:line 193
   at Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions.StartEngine(IApplicationBuilder application) in C:\Development\BlueFire\nopCommerce_4.40_Source\src\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ApplicationBuilderExtensions.cs:line 69
   at Nop.Web.Startup.Configure(IApplicationBuilder application) in C:\Development\BlueFire\nopCommerce_4.40_Source\src\Presentation\Nop.Web\Startup.cs:line 61
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.WebTools.BrowserLink.Net.HostingStartup.<>c__DisplayClass1_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Watch.BrowserRefresh.HostingStartup.<>c__DisplayClass1_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.<StartAsync>d__31.MoveNext()
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__9.MoveNext()
   at Nop.Web.Program.<Main>d__0.MoveNext() in C:\Development\BlueFire\nopCommerce_4.40_Source\src\Presentation\Nop.Web\Program.cs:line 34
   at Nop.Web.Program.<Main>(String[] args)

  This exception was originally thrown at this call stack:
    System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, bool, System.Action<System.Action>)
    System.Data.SqlClient.SqlInternalConnection.OnError(System.Data.SqlClient.SqlException, bool, System.Action<System.Action>)
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject, bool, bool)
    System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject, out bool)
    System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(string, bool, int, bool)
    System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(System.Threading.Tasks.TaskCompletionSource<object>, bool, int, bool, string)
    System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
    FluentMigrator.Runner.Processors.SqlServer.SqlServerProcessor.ExecuteNonQuery(string)

Inner Exception 1:
SqlException: There is already an object named 'AddressAttribute' in the database.
1 anno tempo fa
Do you have the correct connection string ?
Maybe delete the datasettings.json file and see if the the system will do an install and create a temporary database
Once you have done the install and checked the system is working then you can change the connection string to point to the database you want to upgrade and see if that works
1 anno tempo fa
Connection settings are good. I removed the json files and it created a new "v4.4" database and started up fine. I then changed the database in the connection string back to my v4.3 database and got the same exception.

I placed a try/catch around the exception and allowed it to continue and it tries to create all the tables so for some reason the migration is not detecting that my v4.3 database has any existing tables.
1 anno tempo fa
Bump - I really need to get this working as the Braintree plugin for 4.2 becomes obsolete on 2/28. and it looks like you need to be on 4.6 for Braintree to work after 2/28.

I'm thinking that maybe there is an issue with the 4.2 to 4.3 upgrade as the NopAnywhereSliders plugin fails in 4.3 with the same error. But everything else in 4.3 works fine.
1 anno tempo fa
HI

did you check without any 3rd party plugin ?

if possible try without all 3rd party plugin and then you can install or upgrade all the plugin 1 by 1 ,
so using this things it will be workable for you
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.