Skip to content
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

Schema-4.5 cleanup. (DOI model) #1111

Merged
merged 3 commits into from
Feb 23, 2024
Merged

Schema-4.5 cleanup. (DOI model) #1111

merged 3 commits into from
Feb 23, 2024

Conversation

svogt0511
Copy link
Contributor

@svogt0511 svogt0511 commented Feb 1, 2024

Purpose

Related to: Issue #1016, PR#1112

Approach

STEP 1 - This PR which obsoletes the publisher column from the database by making it an active record virtual attribute. To preserve backward compatibility, 'publisher' is still accepted by the API as either a string or a hash, but is saved to the DB or read from the DB as publisher_obj. Also, the API publisher='true' flag still works as documented to return either a string or hash in the response.

STEP 2 - A second PR (PR#1112) which has the rake task to remove the publisher column from the DB, and contains the new schema.rb file.

Open Questions and Pre-Merge TODOs

Learning

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

@svogt0511 svogt0511 force-pushed the schema-4.5-cleanup-r1 branch from c3eb8b4 to 467a13b Compare February 2, 2024 21:59
Copy link
Member

@digitaldogsbody digitaldogsbody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - one question about the impact of the audit change, but it's non-blocking to merge

@@ -5,7 +5,7 @@

class Doi < ApplicationRecord
PUBLISHER_JSON_SCHEMA = "#{Rails.root}/app/models/schemas/doi/publisher.json"
audited only: %i[doi url creators contributors titles publisher publisher_obj publication_year types descriptions container sizes formats version_info language dates identifiers related_identifiers related_items funding_references geo_locations rights_list subjects schema_version content_url landing_page aasm_state source reason]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will removing this remove historical data about changes to the field from the activities table/index/endpoint?

Copy link
Contributor Author

@svogt0511 svogt0511 Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question. Deleting the field name from that line just tells the audit module (activities) to not record changes for that field. It won't erase historical data for publisher or leave those changes out of a call to /activities.

Changes are kept in the audited_changes column of the audits table. For reporting changes, activities just grabs audited_changes, but doesn't care what is in it. For recording changes, the publisher column will be gone, so of course we don't need it recorded.

Copy link
Contributor

@ashwinisukale ashwinisukale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good

@svogt0511 svogt0511 merged commit d5bf268 into master Feb 23, 2024
13 checks passed
@svogt0511 svogt0511 deleted the schema-4.5-cleanup-r1 branch February 23, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants