Skip to content
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

Using custom USER_MODEL with integer id when default one is uuid #576

Open
scherbakovx opened this issue Jun 3, 2020 · 0 comments
Open

Comments

@scherbakovx
Copy link
Contributor

By default migrations use model from AUTH_USER_MODEL, in my case its id is UUID. But I want to use pushes for model where id is integer. When I create new migration and try to apply it, I get such error:

django.db.utils.ProgrammingError: cannot cast type uuid to integer
LINE 1: ...ALTER COLUMN "user_id" TYPE integer USING "user_id"::integer

I found solution for me, but it is rather bad.
Then I looked at migrations files of django-push-notifications and see this row in push_notifications/migrations/0001_initial.py:

('user', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)),

I'm not sure but isn't better to change kwarg to to settings.PUSH_NOTIFICATIONS_SETTINGS["USER_MODEL"] which is anyway AUTH_USER_MODEL by default?

Environment:

Name Version
Django 2.1.5
PostgreSQL 10.3
psycopg2-binary 2.7.7
django-push-notifications 2.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant