Using database triggers to reliably track model history

December 14, 2023 38 min Free

Description

Tracking model history is an essential aspect of many problems encountered in web applications, from simple audit trails to preserving values of fields during state transitions. This talk explores a new approach to tracking history in Django applications using PostgreSQL database triggers, specifically with the django-pghistory app. The benefits of using database triggers for history tracking, including simplicity, performance, and reliability, are discussed. The talk also covers the advantages of using structured history tables for solving complex history-related modeling problems. Attendees will gain insights into a novel way to think about history tracking and its practical application.