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

feature/finish-db-models #7

Merged
merged 15 commits into from
Nov 7, 2020
Prev Previous commit
Next Next commit
Fix MatterStatus primary keys and indexes
  • Loading branch information
JacksonMaxfield committed Nov 6, 2020
commit 268e2a8ef9cf25f093d22096908b855d9b21a4a9
13 changes: 11 additions & 2 deletions cdp_backend/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,17 @@ def Example(cls):
matter_status.update_datetime = datetime.utcnow()
return matter_status

_PRIMARY_KEYS = ("matter_ref",)
_INDEXES = ()
_PRIMARY_KEYS = ("matter_ref", "status", "update_datetime")
_INDEXES = (
IndexedFieldSet(
IndexedField(name="matter_ref", order=Order.ASCENDING),
IndexedField(name="update_datetime", order=Order.ASCENDING),
),
IndexedFieldSet(
IndexedField(name="matter_ref", order=Order.ASCENDING),
IndexedField(name="update_datetime", order=Order.DESCENDING),
),
)


class MatterFile(Model):
Expand Down