Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 2.26 KB

File metadata and controls

58 lines (43 loc) · 2.26 KB

💥 EntityFrameworkCore migrations for Quartz.NET 💥

License Nuget Downloads Tests codecov

⚡️ This library handles schema migrations for Quartz.NET using EntityFrameworkCore migrations toolkit with one line of configuration ⚡️

🔧 Installation 🔧

$> dotnet add package AppAny.Quartz.EntityFrameworkCore.Migrations.PostgreSQL

💡 Supported drivers 💡

🚧 Feel free to create as issue for driver support 🚧

🎨 Usage 🎨

✅ Configure DbContext

public class DatabaseContext : DbContext
{
  // ...

  protected override void OnModelCreating(ModelBuilder modelBuilder)
  {
    // Adds Quartz.NET PostgreSQL schema to EntityFrameworkCore
    modelBuilder.AddQuartz(builder => builder
      .UsePostgres()
      .UseSchema("quartz")
      .UseNoPrefix());
  }
}

✅ Configure Quartz.NET

storeOptions.UsePostgres(postgresOptions =>
{
  postgresOptions.UseDriverDelegate<PostgreSQLDelegate>();
  postgresOptions.ConnectionString = ...;
  postgresOptions.TablePrefix = ...;
});

✅ Add EntityFrameworkCore migration with Quartz.NET schema dotnet ef migrations add AddQuartz and:

🚩 Add in-process migration using databaseContext.Database.MigrateAsync()

🚩 Add out-of-process migration using dotnet ef database update

🚩 Extract SQL for your migration tool dotnet ef migrations script PreviousMigration AddQuartz