Skip to content

shaykhullinsergey/AppAny.Quartz.EntityFrameworkCore.Migrations

 
 

Repository files navigation

💥 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

About

EntityFrameworkCore PostgreSQL migrations for Quartz.NET

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%