PeeringDB runs on django 3.2 - for extensive documentation on the django framework please refer to the [official django documentation](https://docs.djangoproject.com/en/3.2/).
Django uses model classes to define the database schema.
## PeeringDB models
`peeringdb_server` defines its models (and thus db schema) in `peeringdb_server/models.py`
### django-peeringdb
The main schema for peering data is maintained in the public [django-peeringdb](https://github.com/peeringdb/django-peeringdb) module.
`peerigndb_server` uses the abstract models defined in `django-peeringdb` to represent the peering data.
This is important to keep in mind when adding new fields or new models to the schema.
Generally speaking, anything that is going to be exposed to the public on PeeringDB's REST API should be added to the abstract models in `django_peeringdb.models.abstract` so it can be available to users maintaining local snapshots of the database.
Through `django-handleref` and `django-reversion`, snapshots of objects are maintained.
Every time an object is saved a snapshot is created.
This is *not* automatic behavior, and you need to manually open the `reversion.create_revision` context for any code blocks that make changes to objects.
Please refer to [django-reversion](https://django-reversion.readthedocs.io/en/stable/) for further explanation.