Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add option to disable automatic migrations during startup #136

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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; }
}