Adding a migration without a down method is not necessarily an error. It just means that if you revert the migration, what was done in the Up
method won't be undone in the database when reverting it. In this case, removing the migration from the database won't actually drop the stored procedure from the database, since you haven't instructed it in your Down
method.
Therefore, you could just write the code for the Down
method now, instructing EF Core to generate the script to remove your stored procedure. Then, when un-applying the migration EF will remove the stored procedure from the DB. It shouldn't matter that you write the Down code later on.
What you could also do is to remove the migration files and then manually drop the stored procedure from all involved databases (different environments and all local machines of the members of your team, which is not practical... that's what migrations more or less come to solve). However, if migration has been only applied in your local db and maybe one staging environment, you could do it manually without much hassle.
Finally, you could also just add a new migration where in the Up() method and alter the procedure, as you suggested.
IMO, you don't need to worry that much. The only problem (in this scenario) of not having the Down() method is that you won't get the script to revert what was done in the Up() method automatically by EF (in this case, drop the stored procedure). It can be more problematic if the migration was changing the schema and there were also other migrations that had been applied afterwards.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…