Base solution for your next web application
Open Closed

Migrate entity to new table name. #3215


User avatar
0
riaan created

Hi,

Using ASP.NET Zero Core

I discovered during a merge that one of our developers used the incorrect naming convention for our table names on one of the entities.

[Table("PbFoodNotes")]
    public class FoodNote : FullAuditedEntity

should read

[Table("PpFoodNotes")]
    public class FoodNote : FullAuditedEntity

The migration files have already been created.

What would be the best way to change the table name to the correct naming convention with the least impact.

Kind Regards,

Riaan


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Best way is to create a new migration renaming the table. When you change Table attribute and add new migration this should happen automatically.

    If this change is not on the production yet and only in development, you can change Table attribute and wrong migration class's content. In this way you will have less migration files but the developers who applied this change to their local db, need to recreate local databases.

  • User Avatar
    0
    riaan created

    Hi,

    Thanks. Since there is no production DB yet, the easiest way was to follow your suggestion to rename the tablename in code, and drop the local DBs and run the migrator again.

    Worked like a charm. :)