Closed PaigeM89 closed 7 years ago
The project internally uses the EF migrator - I'm not sure there's an API for forcing database migrations, we'll need to have to look at the code for the EF migrator tool to see how they do it.
Fluent would be nice, maybe on the config side?
You can configure the migrator itself via the configuration
options:
_dbMigrator.Configuration.AutomaticMigrationDataLossAllowed = true;
We'd just need to expose this functionality in a consistent way. By on the config side - do you mean on the EfMigratorSettings
object? Or do we want to be able to specify data loss per migrator call?
Sweet! Yeah, I was thinking EfMigratorSettings
, since that'll basically bind dangerous options to the database connection string.
Oh, @PaigeM89 _dbMigrator.Configuration
is configured by EfMigratorSettings.ConfigurationClass
. I believe force is a different option.
I need a way to allow data loss on migrations. This is usually the
-force
command, but there is no way to allow this in the current structure.There are a few different options for implementing this - we could go with a fluent-like interface, such as
migrator.MigrateTo(version).Force()
. We could add an overload, likemigrator.MigrateTo(version, true)
(true being "allow data loss"). Or make a whole new function, likemigrator.MigrateWithDataLoss(version)
.There are pros & cons to each, and this isn't a flag we want the user to be passing without careful consideration.