Add migration
Add a migration for the new property
create a migration
dotnet ef migrations add CityAddedusing Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EFGetStarted.Migrations
{
/// <inheritdoc />
public partial class CityAdded : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "City",
table: "Students",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "City",
table: "Students");
}
}
}Apply migration
Last updated