Erro ao renomear coluna com Entity Framework
Olá!
Estou tendo problemas para renomear uma coluna ao usar o Entity Framework.
Segue o código que quero executar:
namespace CustomizandoCodeFirstMigrations.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AlteraTelefoneFixoRenomeiaCelular : DbMigration
{
public override void Up()
{
RenameColumn("dbo.Pessoas", "Celular", "TelefoneCelular");
AlterColumn("dbo.Pessoas", "TelefoneFixo", c => c.String(nullable: false, unicode: false));
}
public override void Down()
{
RenameColumn("dbo.Pessoas", "TelefoneCelular", "Celular");
AlterColumn("dbo.Pessoas", "TelefoneFixo", c => c.String());
}
}
}
Quando digito *update-database *no Package Manager Console recebo como retorno:
>
Subquery returns more than 1 row
Se eu digitar o comando *update-database -force -verbose, *além da mensagem anterior, recebo:
set @columnType := (select case lower(IS_NULLABLE) when 'no' then CONCAT(column_type, ' not null ') when 'yes' then column_type end from information_schema.columns where table_name = 'Pessoas' and column_name = 'Celular');
set @sqlstmt := (select concat('alter table `Pessoas` change `Celular` `TelefoneCelular` ' , @columnType));
prepare stmt from @sqlstmt;
execute stmt;
deallocate prepare stmt;
Gostaria de saber como posso resolver este problema.
Obrigado!
Discussão (1)
Carregando comentários...