New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage of LocalDateTime for commit timestamps #743
Comments
DateProvider was ctrated to mock clock in test. Javers is not ready for different timestamp types in commit.createDate. |
We would prefer using Its not like you are otherwise doing anything with the |
Sounds good, two things are important here.
Maybe commitDate should be left as is to be used internally by javers, and the new field can be added to Think about contributing |
If commits are stored in a database, this would mean that we would store the value of Regarding your second point, I guess, having some kind of validation to see what Java date types are compatible with the currently chosen database column type might be tricky. At least in our example, I used the output SQL in the application log and then manually changed the type of the |
I'm not suggesting to change an existing field or db column, I suggest to add a new field and a new db column for it public class CommitMetadata implements Serializable {
private final String author;
private final Map<String, String> properties;
// used by JaVers to sort commits, you can't change how it's created
private final LocalDateTime commitDate;
// provided by users by registering an EeffectiveCommitDateProvider, could have arbitrary precision or time zone
private final Temporal effectiveCommitDate;
private final CommitId id; |
After some research, I think, that adding another date (effectiveCommitDate) isn't a good idea. Simply, we should change the type of Btw, we can't just change the type of commit date, it would break compatibility. People have their snapshots persisted in databases with commit date as |
sorting by COMMIT_DATE_INSTANT in MongoRepository
@cberg-zalando @NicoBondarenco PR is ready Now,
|
Released in 5.1.0 |
We added JaVers to one of our projects for managing the history of our database entities. As history support was not a feature desired from the beginning, we used Spring to manage auditing information using the
@CreatedDate
andLastModifiedDate
annotations on properties of typeInstant
. As database we are using PostgreSQL and usingTIMESTAMPTZ
as our field type.We were wondering why there was a difference between these timestamps and the ones JaVers creates for each commit. Digging into the code, I see that you have a
DateProvider
interface which is explicitly usingLocalDateTime
. Was there a reason why this was explicitly limited to that type?The text was updated successfully, but these errors were encountered: