Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Column using migration #59

Open
Esperadoce opened this issue Apr 26, 2017 · 3 comments
Open

Rename Column using migration #59

Esperadoce opened this issue Apr 26, 2017 · 3 comments

Comments

@Esperadoce
Copy link

Esperadoce commented Apr 26, 2017

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 Esperadoce changed the title MigrationBuilder.RenameColumn Rename Column using migration Apr 26, 2017
@SapientGuardian
Copy link
Owner

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

@Esperadoce
Copy link
Author

Yes i have a ModelSnapshot

@SapientGuardian
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants