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

Add an index to the timestamp column #364

Merged
merged 1 commit into from
May 31, 2022
Merged

Add an index to the timestamp column #364

merged 1 commit into from
May 31, 2022

Conversation

gwax
Copy link
Contributor

@gwax gwax commented Mar 11, 2022

Many queries, including the default ordering, for the LogEntry
model rely on the timestamp field. Adding an index will ensure
reasonable scalability for large audit logs.

CHANGELOG.md Outdated
@@ -1,10 +1,13 @@
# Changes

#### Improvements

- index added to the timestamp column
Copy link
Contributor

Choose a reason for hiding this comment

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

This introduced a new schema for the database. I think it should be specified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you clarify what you mean when you ask for the new schema to be specified?

To my understanding, that is what I am saying here: I have added an index to the timestamp column.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a more explicit sentence could be great, something like: "feat(models): index added to LogEntry.timestamp".
I like to see which part of the library is modified when I read changelogs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotcha, how about now?

@codecov
Copy link

codecov bot commented May 26, 2022

Codecov Report

Merging #364 (72a4cc7) into master (bcd0d43) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #364      +/-   ##
==========================================
+ Coverage   86.95%   87.04%   +0.09%     
==========================================
  Files          22       23       +1     
  Lines         575      579       +4     
==========================================
+ Hits          500      504       +4     
  Misses         75       75              
Impacted Files Coverage Δ
...ditlog/migrations/0010_alter_logentry_timestamp.py 100.00% <100.00%> (ø)
auditlog/models.py 82.58% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcd0d43...72a4cc7. Read the comment docs.

CHANGELOG.md Outdated Show resolved Hide resolved
Many queries, including the default ordering, for the LogEntry
model rely on the timestamp field. Adding an index will ensure
reasonable scalability for large audit logs.
@hramezani hramezani merged commit 1e7d320 into jazzband:master May 31, 2022
@gwax gwax deleted the gwax/timestamp-index branch May 31, 2022 16:59
@aleh-rymasheuski
Copy link
Contributor

@hramezani, this pull request seems to cause a new RuntimeWarning in the tests. Do you have an idea why?

..../django-auditlog/.tox/py37-django32/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1361: RuntimeWarning: DateTimeField LogEntry.timestamp received a naive datetime (2000-01-01 00:00:00) while time zone support is active.

@hramezani
Copy link
Member

@alieh-rymasheuski Actually, it is because of 128555f

I've prepared a PR to fix the warning.

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.

4 participants