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

Respect unique keys in materialized views #28

Open
ckoppelman opened this issue Dec 26, 2023 · 3 comments
Open

Respect unique keys in materialized views #28

ckoppelman opened this issue Dec 26, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@ckoppelman
Copy link

Postgres supports unique indexes on materialized views. It would be fantastic if django-db-views migrations would create indexes for unique=True and unique_together like standard Django models.

@BezBartek
Copy link
Owner

Hello,
Yes, I know about it and I have plan to support it.
I also think of more complicated indexes, my idea is to support all what you can provide to indexes: https://docs.djangoproject.com/en/5.0/ref/models/indexes/
for materialized views.

@BezBartek BezBartek added the enhancement New feature or request label Dec 27, 2023
@ckoppelman
Copy link
Author

ckoppelman commented Dec 27, 2023

Terrific. Any advice to patch it in the mean time? I guess I could just RunSQL every time I update my view

@BezBartek
Copy link
Owner

Ye, you need to write your own migration with Run SQL.
you can put that operation in the same migration that creates view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants