0

I am using Hangfirein my ASP.NET Core application. It is still in development, now Every time I run the app I want Hangfire to delete the old Database and create a new Database for each run.

Currently when I Run the application the Hangfire Dashboard still shows old jobs even the ones that are no longer in my Code.

Is the something like below I can perform when configuring Hangfire

HangFirecontext.Database.EnsureDeleted();
HangFirecontext.Database.EnsureCreated();
Makhele Sabata
  • 582
  • 6
  • 16

1 Answers1

0

As far as I know there is no way to programatically remove the Hangfire tables. I think your best option is to drop the tables by executing regular SQL statements as soon as the application started. Hangfire will automatically re-create the tables for you. Alternatively, you can call SqlServerObjectsInstaller.Install() (or the equivalent of another database provider) to re-create the tables right after you dropped them.

Henk Mollema
  • 44,194
  • 12
  • 93
  • 104