'How to generate empty migration in EF Core code-first while ignoring pending changes?

I am aware that the add-migration command will generate a new migration file with empty Up() and Down() methods.

However, I have an error when building which means the migration doesn't get created.

How do I just create a legitimate migration file in spite of the build error?

I want to ignore the error and just create an empty migration file because I need to rename a table and column 'manually' (neither of which have corresponding Models in the code).

I want to do this using migrations to ensure all other team members apply the same changes automatically.

So I can't create a blank migration because of the error and I can't fix the error (using SQL in a migration) because I can't create a migration file.



Solution 1:[1]

Creating a migration without building is dangerous. The tools need to know the current state of the model. If a stale, interim model is used, the next migration will probably be wrong and getting everything back in sync won't be easy.

Fix the error before generating a migration--especially if it's an error with your EF Core mode.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bricelam