Hangfire.PostgreSql
Hangfire.PostgreSql copied to clipboard
Ability to have GUIDs as PK
It would be great to have the option to use GUIDs as the Primary Key for jobs. Perhaps the appropriate place for this could be in the "PostgreSqlStorageOptions()" constructor?
I'm considering opening a pull request for this; I should have some time next week - if that feature is not already being worked on?
It's not as trivial as changing the type with the options. Keep in mind the install SQL scripts have to be changed too. Technically not changed, but rather a new one has to be created which supports your newly supported type(-s). And what if you want to change the type later down the road? Or someone messes up and accidentally removes the property setter, and we default to long
again?
Using uuid means we can no longer use serial for the database to increment the job IDs automatically, and PostgreSQL versions before 13 do not have built-in uuid generation and have to use an extra extension (e.g. uuid-ossp
) for auto-generation. Some organisations have to go through some nasty loops to enable extensions on their PG instances.
With that in mind, I don't think the effort needed to have uuid as PK (optionally) for the job is worth it. What's the actual reason you want to have it?
Postgres versions below 13 will be at end of life / support this year. That may help with implementing this change.
I'm afraid enabling extensions (or not having to) is the least of the mentioned concerns. I personally find it hard to justify such a change without some valid use cases that I'm possibly not aware of.
Really hoping to hear some reasoning.
Same here, would like reasoning.
But I think we are mixing things up. uuid-ossp
is supplementary and not required for the uuid
datatype itself. uuid-ossp
just contains extra functions.
So if we create guids in C# with NewGuid() and not use any uuid-ossp
functions, we decrease the impact a lot already.
Closing as it's not worth the effort right now, unless there's a good reason to. If there is one, we can reopen.