ara
ara copied to clipboard
database: consider jsonfield with django >= 3.1
What component is this about ?
database model, potentially requiring API changes
What is the idea ?
We are not ready to upgrade Django yet (waiting for the next LTS) but django 3.1 was just released with jsonfield support for all database backends whereas it was only compatible with postgresql before: https://docs.djangoproject.com/en/3.1/releases/3.1/#jsonfield-for-all-supported-database-backends
Since a lot of things from Ansible is JSON, this could help us simplify the database schema and also make the fields easily searchable -- I'm thinking like searching through results, host facts or CLI arguments, for example.
3.2 LTS is out: https://www.djangoproject.com/weblog/2021/apr/06/django-32-released/
WIP upgrade to django 3.2: https://github.com/ansible-community/ara/pull/360
By the way, documentation from django and django-rest-framework on jsonfield:
- https://docs.djangoproject.com/en/3.2/ref/models/fields/#jsonfield
- https://www.django-rest-framework.org/api-guide/fields/#jsonfield
- https://www.django-rest-framework.org/api-guide/filtering/#searchfilter