Downgrade Scripts with the same name fail to run
gkrawczyszyn opened this issue · 4 comments
Here is how my migration folders look like:
Everything works fine, until I create downgrade migration: 03-example3.sql in 002 folder.
That's the time when I get following exception:
at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func
2 predicate)
at DbUp.Downgrade.DowngradeEnabledTableJournal.GetInsertScriptCommand(Func1 dbCommandFactory, SqlScript script) at DbUp.Downgrade.DowngradeEnabledTableJournal.StoreExecutedScript(SqlScript script, Func
1 dbCommandFactory)
at DbUp.Support.ScriptExecutor.<>c__DisplayClass18_0.b__0(Func1 dbCommandFactory) at DbUp.Engine.Transactions.NoTransactionStrategy.Execute(Action
1 action)
at DbUp.Engine.Transactions.DatabaseConnectionManager.ExecuteCommandsWithManagedConnection(Action1 action) at DbUp.Support.ScriptExecutor.Execute(SqlScript script, IDictionary
2 variables)
at DbUp.Engine.UpgradeEngine.PerformUpgrade()
Is there any workaround?
- There is. I can rename migration to something unique. But since the project is long running, and will live years.. there is a chance that I will face it one day.
Actually I'm not sure why this solution uses only "file name" to determine script name. Whole dbup is supporting path.
Hi, thanks for the issue. I'll have a look asap and will keep you posted.
Hi @asimeonov
I've tested version 1.1.1-pre of the package and it looks like it fixed the bug!
Thanks for that.
Is there any chance for stable version with the fix?
Greg
@gkrawczyszyn I'm working on more universal solution so I'll need a few more days in order to finish it. Will be back to you shortly. I hope in the begging of the next week to have a the solution published cause I made some fast changes now in order to tackle this case.
Thanks for your support,
Atanas