HangfireIO / HangfireIO/Hangfire
Hangfire MS SQL Server schema should use datetime2 instead of datetime
- Dominant language
- C#
- Stars
- 10.1k
- Forks
- 1.8k
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 1
Description
Hangfire MS SQL Server schema should use `datetime2` instead of `datetime`. This is really a minor issue in a sense. `datetime` data type is mostly deprecated, `datetime2 `does the job better. `datetime2 `offers also increase precision if that is required. But for just in-place replacement `datetime2(3)` can be used.
`datetime `does some rounding also so currently the timestamps aren't really accurate to 100 fractional seconds unlike it looks. `datetime `also takes up 8 bytes of storage, with `datetime2(3)`, only 7 bytes are consumed (with full precision the same though, 8 bytes). These are the notable differences between the two.
This can be done by altering these two files I guess:
https://github.com/HangfireIO/Hangfire/blob/5b696d4174e13c3dd9489cc6a863d3417c632e31/src/Hangfire.SqlServer/DefaultInstall.sql
https://github.com/HangfireIO/Hangfire/blob/5b696d4174e13c3dd9489cc6a863d3417c632e31/src/Hangfire.SqlServer/Install.sql
MS documentation:
https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime2-transact-sql
Contributor guide
Research direction
Start by comparing the timestamp column definitions in src/Hangfire.SqlServer/DefaultInstall.sql and src/Hangfire.SqlServer/Install.sql. Update the schema definitions consistently to use the requested datetime2 precision, then verify that both installation scripts produce matching timestamp types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100