soynatan / django-easy-audit

Yet another Django audit log app, hopefully the simplest one.
GNU General Public License v3.0
735 stars 182 forks source link

Primary Key runs out on lots of events #257

Open dmatriccino opened 1 year ago

dmatriccino commented 1 year ago

A few times, we've had to empty our easyaudit tables due to the amount of data we added because they were failing to insert due to running out of primary keys.

Update the primary_key to a BigInt would help with this

jheld commented 1 year ago

Happy to review a proposed PR. Right now I can't think of any reason not to make the change.

trauty-is-me commented 1 year ago

Just adding a note to the person who ends up implementing this:

In the release notes for this change include information about how Django applies this in migrations. Doing a sqlmigrate on a migration file where the field changes the workflow is:

  1. Create new table with same columns
  2. Insert all existing data into this table
  3. Drop existing table
  4. Rename new table
  5. Recreate indexes.

Given how much data is could be coming into these tables, any custom indexes, or partitions in the DB, the effect of a change like this needs some big warning lights in the release notes, given that this amount of IO could potentially bring the DB offline to users.