I was updating my database by the command line, but then I manually updated one of my tables.
This seems to have disrupted my ability to update-database. I receive
Use Alter column instead AddColumn in up() function
migrationBuilder.AlterColumn<bool>(
name: "IsActive",
table: "Advertisements",
nullable: false,
defaultValue: true);
Or
public override void Up()
{
AddColumn("dbo.Products", "Description", c => c.String(maxLength: 50));
}
asp.net migration
You can remark some parts in up function if you dont want to full effect to database.
If your migration command angried for making those. Reset and rebase migration. How:
Delete migration content both from visualstudio and sql and add-migration
again and update-database
First, that is not EF 6, it is EF Core. There is no -IgnoreChanges currently in EF Core (see here) but you can achieve the equivalent by commenting out all the code in the Up() method and applying the migration. This will take a snapshot of the current model state so that subsequent migrations will only include changes from that point forward.
So if you just made some incremental model change and you don't have this initial baseline you may need to remove those changes, apply the baseline migration, then add your changes back and add a 2nd migration.