migrating-ravens / RavenMigrations

A small migrations framework to help you manage your RavenDB Instance.
MIT License
53 stars 24 forks source link

Supply database name to operations #56

Closed lahma closed 3 years ago

lahma commented 3 years ago

Currently when running against named database and document store was built without defining default database (multi-tenancy, no correct default answer) the runner fails to handle exclusive locks.

09:25:45 ERROR MigrationConsole - System.InvalidOperationException: Cannot use Operations without a database defined, did you forget to call ForDatabase?
   at Raven.Client.Documents.Operations.OperationExecutor.GetContext(JsonOperationContext& context) in C:\Builds\RavenDB-Stable-5.0\50009\src\Raven.Client\Documents\Operations\OperationExecutor.cs:line 74
   at Raven.Client.Documents.Operations.OperationExecutor.SendAsync[TResult](IOperation`1 operation, SessionInfo sessionInfo, CancellationToken token) in C:\Builds\RavenDB-Stable-5.0\50009\src\Raven.Client\Documents\Operations\OperationExecutor.cs:line 60
   at Raven.Client.Util.AsyncHelpers.RunSync[T](Func`1 task) in C:\Builds\RavenDB-Stable-5.0\50009\src\Raven.Client\Util\AsyncHelpers.cs:line 133

Operations should be supplied with database name just like migration does:

https://github.com/migrating-ravens/RavenMigrations/blob/2d7859db66559c90752efc2526abfdd090269c19/Raven.Migrations/Migration.cs#L96-L105

JudahGabriel commented 3 years ago

Great, thanks for these PRs.