mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 08:11:08 -05:00
1012 B
1012 B
Model Migration Protocol for History Tracking
Implementation Steps
-
Base Model Setup
# core/models.py import pghistory class HistoricalModel(models.Model): class Meta: abstract = True @pghistory.track(pghistory.Snapshot()) def save(self, *args, **kwargs): return super().save(*args, **kwargs) -
Concrete Model Implementation
# parks/models.py class Park(HistoricalModel): @pghistory.track( pghistory.Snapshot('park.create'), pghistory.AfterUpdate('park.update'), pghistory.BeforeDelete('park.delete') ) class Meta: # Existing model fields and configuration -
Migration Generation
./manage.py makemigrations --name add_pghistory_tracking
Quality Assurance
- Verify historical events table creation
- Test event triggering for CRUD operations
- Validate context metadata capture