SapientGuardian.EntityFrameworkCore.MySql icon indicating copy to clipboard operation
SapientGuardian.EntityFrameworkCore.MySql copied to clipboard

Rename Column using migration

Open Esperadoce opened this issue 8 years ago • 3 comments
trafficstars

Hi, I am using spaientGuardian with ASP Net Core 1.1 in a code first model, when i try to rename a column using migrations and update the database the column does not change its name.

See example below.

   protected override void Up(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.RenameColumn(
            name: "Type",
            table: "Category",
            newName: "Name");
    }

    protected override void Down(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.RenameColumn(
            name: "Name",
            table: "Category",
            newName: "Type");
    }

Esperadoce avatar Apr 26 '17 08:04 Esperadoce

Do you have a <YourContext>ModelSnapshot.cs file in your Migrations folder?

SapientGuardian avatar Apr 29 '17 17:04 SapientGuardian

Yes i have a ModelSnapshot

Esperadoce avatar May 04 '17 07:05 Esperadoce

Can you share it, or at least the bits that are relevant to that column?

SapientGuardian avatar May 04 '17 10:05 SapientGuardian