-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use native enums if the database supports them #18
Comments
Good idea, it would be interesting to try it out. It could be as simple as overriding https://docs.djangoproject.com/en/dev/howto/custom-model-fields/#custom-database-types |
In postgres you have to run CREATE TYPE first so a migration is required. |
Any progress on this? |
I'm gonna try to implement it when I'm in London. |
"2. Changing the member list of ENUM columns is very expensive." |
I'm looking at a different path, which would have enum values in a classic lookup table with foreign key instead. The table has auto_id, enum_value, enum_label , and i'm trying to come up with a reasonably safe sync method that updates existing databases with new model code from the enum classes as needed. django-enumfield is cool as its implemented, but i really want to enforce referential integrity at the db level, and also have my database make sense to someone who has never looked at django/python at all. If someone has done this already, i'd appreciate a pointer. |
Upstream Django issue: #24342: Add EnumField model/form fields Related implementation: https://github.com/ashleywaite/django-more/tree/master/django_enum |
is this a stale issue? looks like the issue is dormant on the upstream django tickets board. it would be nice if this library can support it. Happy to open a PR if it would be considered |
All major databases that Django support already supports enums at the database level.
You can also implement enums in SQLite using CHECK.
Is there a good way to hook into south and django migrations framework in order to make this field use their native database type?
The text was updated successfully, but these errors were encountered: