Rail design for database recording (employment)

So, I have a Rails application that tracks employees. We want to track employment history over time. We would like to be able to fulfill the following types of requests:

  • Search for employees by their current status (salary, manager, name, etc.).
  • Search for specialists by status for a specific date.
  • Search for employees who have ever met the condition

We do not mind that historical requests are much slower, even 2 orders of magnitude slower.

This story is different from the audit trail - the audit trail is the data history, so the audit trail will tell you “what salary was saved for employee X on date Y”, but this will not allow you to correct that old data if it is erroneous.

[We also use audit trails for audit purposes, but I think of the logic for audit trails as requirements for an almost orthogonal design.]

Is there a well-known database design pattern for the best implementation of such a story? Or a site on which I can find a discussion of various "obvious" projects and trade-offs? Any Rails plugins?

Rails 2.3.5 with Ruby 1.8.7, if that matters.

+3
source share
1 answer

, paper_trail , . , (1) (2) - (3), , , .

, - , , , , .

+1

Source: https://habr.com/ru/post/1787780/


All Articles