Found 7 packages
Enable Automatic Migrations for Entity Framework Core for SQL Databases without manual migration files. The package support following ways to apply/view-applied migrations: ### Context methods * Execute(TContext context); * Execute(TContext context, TMigrationsOptions options); * ExecuteAsync(TContext context, CancellationToken cancellationToken); * ExecuteAsync(TContext context, TMigrationsOptions options, CancellationToken cancellationToken); ### Extensions methods * MigrateToLatestVersion<TContext, TMigrationsOptions>(this TContext context); * MigrateToLatestVersion<TContext, TMigrationsOptions>(this TContext context, TMigrationsOptions options); * MigrateToLatestVersionAsync<TContext, TMigrationsOptions>(this TContext context, CancellationToken cancellationToken); * MigrateToLatestVersionAsync<TContext, TMigrationsOptions>(this TContext context, TMigrationsOptions options, CancellationToken cancellationToken);
Enable Automatic Migrations for Entity Framework Core NetTopologySuite for the Microsoft SQL Server databases. How to use: Enable mapping to spatial types via NTS options.UseSqlServer( @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Database", x => x.UseNetTopologySuite()); // Migrations Options public class DbMigrationsOptions { /// <summary> /// Allow auto migration with data lost /// </summary> public bool AutomaticMigrationDataLossAllowed { get; set; } = false; /// <summary> /// Enable to execute auto migration /// </summary> public bool AutomaticMigrationsEnabled { get; set; } = true; /// <summary> /// Remove all tables from database and recreate based on model snapshot. All data would be deleted /// </summary> public bool ResetDatabaseSchema { get; set; } = false; } Option 1 (using method): MigrateDatabaseToLatestVersion.Execute(context); MigrateDatabaseToLatestVersion.Execute(context, new DbMigrationsOptions { ResetDatabaseSchema = true }); Option 2 (using context extension) context.MigrateToLatestVersion(); context.MigrateToLatestVersion(new DbMigrationsOptions { ResetDatabaseSchema = true });
Code driven auto-migrations for Entity Framework Core
Enable automatic Entity Framework Core migrations for PostgreSQL databases without manual migration files. This package is specifically optimized for PostgreSQL with support for schemas, bytea storage, UUID extensions, and PostgreSQL-specific data types. How to use: /// Migrations Options public class DbMigrationsOptions { /// <summary> /// Allow auto migration with data lost /// </summary> public bool AutomaticMigrationDataLossAllowed { get; set; } = false; /// <summary> /// Enable to execute auto migration /// </summary> public bool AutomaticMigrationsEnabled { get; set; } = true; /// <summary> /// Drop all tables from database and recreate based on model snapshot. Useful in scenarios when the data is transient and can be dropped when the schema changes. For example during prototyping, in tests, or for local changes. /// </summary> public bool ResetDatabaseSchema { get; set; } = false; /// <summary> /// Allow to update snapshot.The key will pe replaced with value for each KeyValuePair /// </summary> public Dictionary<![CDATA[string, string]]> UpdateSnapshot { get; set; } = new Dictionary<![CDATA[string, string]]>; /// <summary> /// The schema of the table of migration table. If not specified, the model schema will be used /// </summary> public string Schema { get; set; } } Option 1 (using method): MigrateDatabaseToLatestVersion.Execute(context); MigrateDatabaseToLatestVersion.Execute(context, new DbMigrationsOptions { ResetDatabaseSchema = true }); Option 2 (using context extension) context.MigrateToLatestVersion(); context.MigrateToLatestVersion(new DbMigrationsOptions { ResetDatabaseSchema = true });
Enable Automatic Migrations for Entity Framework Core for SQL Databases. How to use: //Migrations Options public class DbMigrationsOptions { public bool AutomaticMigrationDataLossAllowed { get; set; } = true; public bool AutomaticMigrationsEnabled { get; set; } = true; } Option 1 (using method): MigrateDatabaseToLatestVersion.ExecuteAsync(context).Wait(); Option 2 (using context extension) context.MigrateToLatestVersion();
Automatic EF Core migrations on startup for ASP.NET Core and Generic Host apps.
Ef Core AutoMigrations