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

Allow to modify the truncated length of columns of pidea_audit #1756

Open
fredreichbier opened this issue Jul 23, 2019 · 0 comments

Comments

@fredreichbier
Copy link
Member

commented Jul 23, 2019

The lengths of the columns of the pidea_audit table are hardcoded in the audit_column_length dictionary in models.py:

audit_column_length = {"signature": 620,

If users want to increase the column lengths, they can manually alter the SQL table (see #525). However, if PI_AUDIT_SQL_TRUNCATE is True (as it is in new installations now), the audit class will truncate fields to the lengths specified in audit_column_length even if the actual column size might be greater. It would be nice if one could increase the truncated size without having to edit models.py.

I think this could be fixed in two ways:

  • We could allow users to overwrite parts of audit_column_length in pi.cfg and use these settings in models.py too. Then, if a user writes
    PI_AUDIT_COLUMN_LENGTHS = {"user": 40}
    
    in pi.cfg, a pi-manage createdb would create an audit table with an enlarged user column, and also truncate values accordingly. This way might be tricky, because when we create the models, we do not have access to the Flask app.config because the Flask app doesn't exist yet. But there might be a way to circumvent that :-)
  • Alternatively, we could require users to manually alter the column sizes, and only allow them to overwrite the truncated lengths, e.g.
    PI_AUDIT_SQL_TRUNCATE = True
    PI_AUDIT_SQL_TRUNCATED_LENGTHS = {"user": 40}
    
    which would cause the SQL audit module to truncate the user field to 40 characters, not 20.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.