-
Notifications
You must be signed in to change notification settings - Fork 4
Skip the automatic unique index setting #11
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
base: master
Are you sure you want to change the base?
Conversation
f358923
to
1b045b3
Compare
Thanks for the PR but it'd unlikely we'd be able to accept it. Django convention for ID related fields is to create a unique index by default, and this library follows that pattern. If you wish to disable the unique index - the idea is you explicitly disable it with |
@djm well, that's unfortunate, but i get it. tks |
also, idk what are you using as a convention to force this, but UUIDField for instance doesn't do this, nor Big/Small AutoFields. |
This is true. We chose to ship the default as
This I need to understand more. It looks like
Have you got any code to show what it does? Or a small replication project to show the problem better? We're open to changing the default but it would naturally be a breaking change for this project so we must do it for the right reasons. Thanks! |
@djm here you go: https://github.com/georgeyk/foo/blob/main/demo/foo/migrations/0001_initial.py#L47 |
Thanks @georgeyk, we'll look into this and I'll give an update soon. |
I'm not seeing a way to disable the |
The proposed change is related to https://github.com/jazzband/django-simple-history
When creating an historical table, the fields are copied and adjusted, so it can reflect the fields properly. For the id field, that mostly means it's no longer unique, since the historical table is tracking changes of a single record.
I'm guessing that when generating migrations (using deconstruct), it will see "unique=True" that wasn't really there. So, in short, I believe that is just easier to do the same as the regular CharField, instead of fixing deconstruct, but your call.
poc looks like this: