Me chamo Aristóteles Coutinho, sou desenvolvedor de software há 8 anos, e atualmente trabalho na Jus.com.br. Sou apaixonado por Ruby, e tenho um blog onde escrevo sobre Ruby e outras coisas.
After exec dotnet ef database update command returns this error for me:
uild started...
Build succeeded.
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (76ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
ALTER TABLE "AspNetUsers" ALTER COLUMN "TwoFactorEnabled" TYPE boolean;
ALTER TABLE "AspNetUsers" ALTER COLUMN "TwoFactorEnabled" SET NOT NULL;
ALTER TABLE "AspNetUsers" ALTER COLUMN "TwoFactorEnabled" DROP DEFAULT;
Failed executing DbCommand (76ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
ALTER TABLE "AspNetUsers" ALTER COLUMN "TwoFactorEnabled" TYPE boolean;
ALTER TABLE "AspNetUsers" ALTER COLUMN "TwoFactorEnabled" SET NOT NULL;
ALTER TABLE "AspNetUsers" ALTER COLUMN "TwoFactorEnabled" DROP DEFAULT;
Npgsql.PostgresException (0x80004005): 42804: column "TwoFactorEnabled" cannot be cast automatically to type boolean
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming)
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 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)
Exception data:
Severity: ERROR
SqlState: 42804
MessageText: column "TwoFactorEnabled" cannot be cast automatically to type boolean
Hint: You might need to specify "USING "TwoFactorEnabled"::boolean".
File: tablecmds.c
Line: 10363
Routine: ATPrepAlterColumnType
42804: column "TwoFactorEnabled" cannot be cast automatically to type boolean
That's strange, are you starting /w a fresh database? At the first look this seems to be an issue between ASP.NET Core and PostgreSql, try testing /w Maria/Mysql also.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
After exec
dotnet ef database updatecommand returns this error for me:That's strange, are you starting /w a fresh database? At the first look this seems to be an issue between ASP.NET Core and PostgreSql, try testing /w Maria/Mysql also.