SRoddis/Mongo.Migration

Bug: Unable to use only on-the-fly migrations

Opened this issue · 1 comments

Version: 3.1.4
dotnet version: 6

Problem

When setting up the application for just on the fly migrations, the library tries to automatically run start up based migrations. However, this fails because no database name is provided with a NoDatabaseNameFoundException exception in the StartUpDatabaseMigrationRunner class.

The work around is to add a stub class with the CollectionLocation attribute so that a database can be resolved.

[CollectionLocation("migrations", "clinical")]
public record CollectionLocationInjector();

Proposed Solution

Allow the user to disable start up migrations or just not run start up based migrations if there is no database name is provided.

Can you explain the work around a bit further i am trying to get the version 3.1.4 running, but I am not entirely sure on where i should insert the stub class so that it works. Maybe you can clarify it a bit.

Thank you in advance