Mongo.Migration icon indicating copy to clipboard operation
Mongo.Migration copied to clipboard

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

Open Lukejkw opened this issue 3 years ago • 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.

Lukejkw avatar Sep 14 '22 07:09 Lukejkw

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

HarryHirsch44 avatar Oct 12 '23 14:10 HarryHirsch44