Skip to content

Commit

Permalink
Add option to disable automatic migrations during startup
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-michael authored and vova3211 committed Dec 18, 2024
1 parent 7e1120e commit ebe4754
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/AspNetCore.Identity.Mongo/MongoIdentityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public static IdentityBuilder AddIdentityMongoDbProvider<TUser, TRole, TKey>(thi
var roleCollection = MongoUtil.FromConnectionString<TRole>(dbOptions, dbOptions.RolesCollection);

// apply migrations before identity services resolved
Migrator.Apply<MigrationMongoUser<TKey>, TRole, TKey>(migrationCollection, migrationUserCollection, roleCollection);
if (!dbOptions.DisableAutoMigrations)
Migrator.Apply<MigrationMongoUser<TKey>, TRole, TKey>(migrationCollection, migrationUserCollection, roleCollection);

var builder = services.AddIdentity<TUser, TRole>(setupIdentityAction ?? (x => { }));

Expand Down
2 changes: 2 additions & 0 deletions src/AspNetCore.Identity.Mongo/MongoIdentityOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ public class MongoIdentityOptions
public SslSettings SslSettings { get; set; }

public Action<ClusterBuilder> ClusterConfigurator { get; set; }

public bool DisableAutoMigrations { get; set; }
}

0 comments on commit ebe4754

Please sign in to comment.