Skip to content

EF Migrations Down() method #14382

@ichensky

Description

@ichensky

For migrations EntityFramework has two methods: Up() and Down().
First should apply migration to DB, second revert it.
But what the benefits/idea of Down() method?
There are no real scenarios in life when it would be necessary to use it.
If you apply several migrations (for ex. 10) to database and after this user add some new data and after some time you want revert changes with method Down(), Down() method will never work fine, because it can miss or break users data. Instead of reverting applied migrations better add new one, that will fix errors correctly.
So, now people not correctly use method Down(), they write inside of it code that may be can revert migrations in ideal world, where users never add data to database and after all this they never call the method, so people just waste time for writing usefulness code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions