Gostaria de saber como posso resolver o seguinte problema. Tenho a classe abaixo:
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());
}
}
}
E quando digito no package manager console o comando update-database recebo como resposta:
Subquery returns more than 1 row
select * from Pessoas
eselect * from __MigrationHistory
.select * from pessoas
é:1, João Batista, [email protected], (12)1234-5678, (12)99778-0000
e o retorno deselect * from __MigrationHistory
é201512231623056_InitialCreate, CustomizandoCodeFirstMigrations.K19Context, blob, 6.1.3-40302
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` changeCelular
TelefoneCelular
' , @columnType)); prepare stmt from @sqlstmt; execute stmt; deallocate prepare stmt;`