2
I would like to know how I can solve the following problem. I have the class below:
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());
}
}
}
And when I type in the package manager console the update-database command I get as a response:
Subquery Returns more than 1 Row
I need two more pieces of information before I answer: the return of
select * from Pessoas
andselect * from __MigrationHistory
.– Leonel Sanches da Silva
@Gypsy omorrisonmendez The return of
select * from pessoas
is:1, João Batista, [email protected], (12)1234-5678, (12)99778-0000
and the return ofselect * from __MigrationHistory
is201512231623056_InitialCreate, CustomizandoCodeFirstMigrations.K19Context, blob, 6.1.3-40302
– João Batista
If you consider it important, when running the update-database -force -verbose command, I receive as part of the reply:
Telephone
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
Peoplechange
Cellular' , @columnType));
prepare stmt from @sqlstmt;
execute stmt;
deallocate prepare stmt;
– João Batista
@I appreciate the help. A colleague from a Facebook group explained to me that it could be the fact that there is another table with the same name in another schema. I deleted the previous schema and ran the update-database command and everything worked.
– João Batista
I’ll just synthesize an answer, okay?
– Leonel Sanches da Silva