Django Models - Default and Choices made to Table Schema
|Reported by:||seanmccully||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.0|
|Severity:||Normal||Keywords:||Models Default Choices|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I am pretty new to Django/python. While working on a project for Work, Ive run into a few seperations the Database layer from Table Schemas. We are using Postgres database(s), and when applying the column attribute Default or Choices to Fields Ive noticed that this is not applied to the table schema as an enumerated type and default keyword.
As such, I would like to see when choices are applied to a field the database schema uses an enumerated type to describe this. This enforces several data constinencies, and I think is a better way to describe the data and I believe saves space by values being stored as an index not a string value of descriptions (makes sense?).
The same goes for default, and adding a DEFAULT behavior for the column/field.