imsweb / django-history-triggers

Django management command and middleware for creating and maintaining PostgreSQL audit trail triggers.
BSD 2-Clause "Simplified" License
3 stars 7 forks source link

Lowercase history table_name before checking if it exists: #1

Closed ruttenb closed 6 years ago

ruttenb commented 6 years ago

We do this because the CREATE TABLE sql command is automatically lower casing table_name since it is not wrapped in double quotes. This is an issue for app labels that have upper case letters. The table_exists function is always returning false if the app has upper case letters. Then, an exception is raised when attempting to create a table with the same name.

dcwatson commented 6 years ago

I guess if I were writing this all over again, I'd try to make the history tables match the case of the source tables. But given that postgres automatically lowercases anyway, I think this is fine.