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

Modify change field to be a json field. #407

Merged

Commits on Dec 27, 2022

  1. Modify change field to be a json field.

    Storing the object changes as a json is preferred because it allows SQL
    queries to access the change values. This work moves the burden of
    handling json objects from an implementation of python's json library in
    this package and puts it instead onto the ORM. Ultimately, having the
    text field store the changes was leaving them less accessible to external
    systems and code that is written outside the scope of the django
    auditlog.
    
    This change was accomplished by updating the field type on the model and
    then removing the JSON dumps invocations on write and JSON loads
    invocations on read. Test were updated to assert equality of
    dictionaries rather than equality of JSON parsable text.
    
    Separately, it was asserted that postgres will make these changes to
    existing data. Therefore, existing postgres installations should update the
    type of existing field values without issue.
    sum-rock committed Dec 27, 2022
    Configuration menu
    Copy the full SHA
    01480ad View commit details
    Browse the repository at this point in the history
  2. Add test coverage for messages exceeding char len

    The "Modify change field to be a json field" commit reduced test
    coverage on the mixins.py file by 0.03%. The reduction in coverage was
    the result of reducing the number of operations required to achieve the
    desired state. An additional test was added to increase previously
    uncovered code. The net effect is an increase in test case coverage.
    sum-rock committed Dec 27, 2022
    Configuration menu
    Copy the full SHA
    c1e6000 View commit details
    Browse the repository at this point in the history
  3. Add line to changelog

    Better markdown formatting
    
    Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
    sum-rock and hramezani committed Dec 27, 2022
    Configuration menu
    Copy the full SHA
    3294422 View commit details
    Browse the repository at this point in the history
  4. Update CHANGELOG text format

    More specific language in the improvement section regarding `LogEntry.change`
    
    Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
    sum-rock and hramezani committed Dec 27, 2022
    Configuration menu
    Copy the full SHA
    af571f3 View commit details
    Browse the repository at this point in the history
  5. Update migration to show Django version 4.0

    Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
    sum-rock and hramezani committed Dec 27, 2022
    Configuration menu
    Copy the full SHA
    f9d6687 View commit details
    Browse the repository at this point in the history
  6. Update CHANGELOG to show breaking change

    Running the migration to update the field type of `LogEntry.change` is a breaking change.
    
    Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
    sum-rock and hramezani committed Dec 27, 2022
    Configuration menu
    Copy the full SHA
    cba7b71 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ad49d45 View commit details
    Browse the repository at this point in the history
  8. Adjust manager method for compatibility

    The create log method on the LogEntry manager required an additional
    kwarg for a call to create an instance regardless of a change or not.
    This felt brittle anyway. The reason it had worked prior to these
    changes was that the `change` kwarg was sending a string "null" and
    not a None when there were no changes.
    sum-rock committed Dec 27, 2022
    Configuration menu
    Copy the full SHA
    56f9da0 View commit details
    Browse the repository at this point in the history