Django Schema History is a package that tracks schema changes in Django models and stores the history in the database. It helps developers monitor changes such as adding, modifying, or removing fields.
- Tracks model schema changes automatically.
- Records field additions, modifications, and deletions.
- Stores historical data in a structured format.
- Integrates seamlessly with Django's migration system.
You can install Django Schema History using pip:
pip install django-schema-history- Add
schema_historyto yourINSTALLED_APPSinsettings.py:
INSTALLED_APPS = [
...
'schema_history',
]- Run migrations:
python manage.py migrate schema_historyTo track schema changes, run the following command:
python manage.py track_schema_changesThis will log and save schema changes into the SchemaChange model.
The package stores schema changes in the SchemaChange model:
class SchemaChange(models.Model):
action_type = models.CharField(max_length=50) # e.g., added_field, removed_field
model_name = models.CharField(max_length=255)
field_name = models.CharField(max_length=255)
timestamp = models.DateTimeField(auto_now_add=True)Contributions are welcome! Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.
Developed by Moundher. 🚀