abp icon indicating copy to clipboard operation
abp copied to clipboard

Migration issue isExternal property more than one.

Open pascalfossouo opened this issue 6 years ago • 4 comments

Hi Have an issue when running BookStore-Mvc-EfCore on 2020-10-17

  • set the .DMigration in PMC run: add-migration upgrade_3_2_1
  • run: update-database

or set the .DMigrator to a default project and run

Microsoft.Data.SqlClient.SqlException: 'Column names in each table must be unique. Column name 'IsExternal' in table 'AbpUsers' is specified more than once.'

update-database Build started... Build succeeded. Applying migration '20201015020747_Upgraded_To_Abp_3_2_1'. Failed executing DbCommand (9ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] ALTER TABLE [AbpUsers] ADD [IsExternal] bit NOT NULL DEFAULT CAST(0 AS bit); Microsoft.Data.SqlClient.SqlException (0x80131904): Column names in each table must be unique. Column name 'IsExternal' in table 'AbpUsers' is specified more than once. at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite) at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName) at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery() 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(IEnumerable`1 migrationCommands, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) ClientConnectionId:88a76cab-f0b5-4648-97d8-dcbc031af7fb Error Number:2705,State:4,Class:16 Column names in each table must

pascalfossouo avatar Oct 17 '20 17:10 pascalfossouo

Delete your database and try again.

realLiangshiwei avatar Oct 19 '20 01:10 realLiangshiwei

Hi @realLiangshiwei this is my connection string

Server=(LocalDb)\MSSQLLocalDB;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true

and I'm using SQL Server with SSMS, but I don't see any BookStore database on my SQL Server

pascalfossouo avatar Oct 19 '20 02:10 pascalfossouo

Can you share some screenshots

realLiangshiwei avatar Oct 22 '20 08:10 realLiangshiwei

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 21 '20 09:12 stale[bot]