abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.88k stars 3.44k forks source link

Error on update database #14311

Closed BogdanJak closed 2 years ago

BogdanJak commented 2 years ago

By following your tutorial from the address https://docs.abp.io/en/abp/latest/Tutorials/Part-7?UI=BlazorServer&DB=EF I have created a Customer class and want to update my database. Create a pierced migration seamlessly while following the command dotnet ef database update --context OrganizerPRODbContext

i am getting the following error

Build started... Build succeeded. Applying migration '20221006180518_Initial'. Failed executing DbCommand (7ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE [AbpAuditLogs] ( [Id] uniqueidentifier NOT NULL, [ApplicationName] nvarchar(96) NULL, [UserId] uniqueidentifier NULL, [UserName] nvarchar(256) NULL, [TenantId] uniqueidentifier NULL, [TenantName] nvarchar(64) NULL, [ImpersonatorUserId] uniqueidentifier NULL, [ImpersonatorUserName] nvarchar(256) NULL, [ImpersonatorTenantId] uniqueidentifier NULL, [ImpersonatorTenantName] nvarchar(64) NULL, [ExecutionTime] datetime2 NOT NULL, [ExecutionDuration] int NOT NULL, [ClientIpAddress] nvarchar(64) NULL, [ClientName] nvarchar(128) NULL, [ClientId] nvarchar(64) NULL, [CorrelationId] nvarchar(64) NULL, [BrowserInfo] nvarchar(512) NULL, [HttpMethod] nvarchar(16) NULL, [Url] nvarchar(256) NULL, [Exceptions] nvarchar(max) NULL, [Comments] nvarchar(256) NULL, [HttpStatusCode] int NULL, [ExtraProperties] nvarchar(max) NULL, [ConcurrencyStamp] nvarchar(40) NULL, CONSTRAINT [PK_AbpAuditLogs] PRIMARY KEY ([Id]) ); Microsoft.Data.SqlClient.SqlException (0x80131904): There is already an object named 'AbpAuditLogs' in the database. at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) in //src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs:line 1853 at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in //src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnection.cs:line 611 at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) in //src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs:line 1327 at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) in //src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs:line 2550 at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite) in //src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs:line 3233 at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName) in //src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs:line 1546 at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery() in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs:line 1090 at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable1 migrationCommands, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) ClientConnectionId:5c89fcba-1b0c-41d4-acec-c8f291c6c9a6 Error Number:2714,State:6,Class:16 There is already an object named 'AbpAuditLogs' in the database.`

BogdanJak commented 2 years ago

Sorry - I find my mistake