ApplicationInsight Error 'There is already an object named 'Job' in the database.'

For some reason I’am getting the following error in ApplicationInsight:

There is already an object named ‘Job’ in the database.
Installing Hangfire SQL objects…
Database schema [HangFire] already exists
Table [HangFire].[Schema] already exists
Current Hangfire schema version: none
Enabling HEAVY_MIGRATIONS, because we are installing objects from scratch
Installing schema version 1

Someone else reported the same issue here:

But no solution was suggested,

is there anyone else with this problem aswell?
Or does anyone know a simple fix?

For 1 specific environment I can just delete the DB and re-create it, but I’d rather not do that to a few hundred environments.


Am using HangFire 1.7.33, but just upgraded to 1.8.0

Please check if your [HangFire].[Schema] table contains any entries. There should be a row that specifies the current version, and it’s difficult to detect what’s the current schema based on other things.

If it doesn’t contain any rows, then perhaps you should insert one, but we should understand first the actual version of your schema.

The simplest way if you always was using Hangfire 1.7.X – in this case just insert the row with value 7 to that table. If you was using prior versions let me know and we’ll try to guess the actual number.

It looks like the table Schema is empty, is there any error that could cause this?

Nothing – only migration script updates that value, but nothing deletes it. Perhaps tables cleared manually, or something like this happened.