-
Notifications
You must be signed in to change notification settings - Fork 8
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
Track updates to relationships #376
Track updates to relationships #376
Conversation
Track updates to relationships in all related tables by adding a new field `relationship_updated_at` to all principal tables (see below) that is updated with the current date anytime a change happens to a relationship (create/update/delete) Specifically the principal tables are (with join tables nested) - [x] measures - [x] measure_categories - [x] measure_indicators - [x] indicators - [x] measure_indicators - [x] users - [x] user_roles - [x] user_categories
We want to call the `last_modified_user_id` field `updated_by_id` instead.
We want to record who created each record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only thing missing was adding those fields to the serializer
@@ -12,6 +12,10 @@ class Measure < VersionedRecord | |||
has_many :due_dates, through: :indicators | |||
has_many :progress_reports, through: :indicators | |||
|
|||
belongs_to :parent, class_name: "Measure", required: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think measures have parent measures here
add_column :indicators, :relationship_updated_at, :datetime, precision: 6, null: true | ||
add_column :measures, :relationship_updated_at, :datetime, precision: 6, null: true | ||
add_column :users, :relationship_updated_at, :datetime, precision: 6, null: true | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also want to track relationship updates to the recommendations table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specifically recommendation_categories, recommendation_indicators, recommendation_measures and recommendation_recommendations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to track changes to sdgtargets btw - in fact as we no longer use they could/should also be dropped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally, we should also consider tracking category relationship updates, including
- to its parent category (parent_id) and also the inverse (the parent if assigned a child)
- to its manager (manager_id) and also the inverse (the user if assigned a category)
but let's leave this for later
We want to bring in the developments from advocacy-tracker-server:
relationship_updated_at
when relationship changes dumparkltd/advocacy-tracker-server#53relationship_updated_by_id
when relationship changes dumparkltd/advocacy-tracker-server#57And from marine-defrag-server:
last_modified_user_id
toupdated_by_id
marine-defrag/marine-defrag-server#43created_by_id
to all tables marine-defrag/marine-defrag-server#42Resolves #362