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

Add official support for Django 5.0 #49

Merged
merged 9 commits into from
Feb 21, 2024
Merged

Conversation

browniebroke
Copy link
Contributor

Didn't find anything that needed fixing, but let me know if I missed anything.

Copy link
Owner

@tbicr tbicr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for PR

I left small comment for tox changes.

I also see changes for null_distinct in django/db/backends/base.py
image
django/django@4.2...5.0#diff-f7637259acc1ecbb74910a7df2879cae5f3209d7a87ab0ad06dbd594b27f1831L112-L133 than nice to add, for example in django_zero_downtime_migrations/backends/postgres/schema.py:

    if django.VERSION[:2] >= (5, 0):
        sql_create_unique = MultiStatementSQL(
            PGShareUpdateExclusive(
                "CREATE UNIQUE INDEX CONCURRENTLY %(name)s ON %(table)s (%(columns)s)s%(nulls_distinct)s",
                disable_statement_timeout=True
            ),
            PGAccessExclusive("ALTER TABLE %(table)s ADD CONSTRAINT %(name)s UNIQUE USING INDEX %(name)s"),
        )
    else:
        sql_create_unique = MultiStatementSQL(
            PGShareUpdateExclusive("CREATE UNIQUE INDEX CONCURRENTLY %(name)s ON %(table)s (%(columns)s)",
                                   disable_statement_timeout=True),
            PGAccessExclusive("ALTER TABLE %(table)s ADD CONSTRAINT %(name)s UNIQUE USING INDEX %(name)s"),
        )

and

    if django.VERSION[:2] >= (5, 0):
        sql_create_unique_index = PGShareUpdateExclusive(
            "CREATE UNIQUE INDEX CONCURRENTLY %(name)s ON %(table)s "
            "(%(columns)s)%(include)s%(condition)s%(nulls_distinct)s",
            disable_statement_timeout=True
        )
    else:
        sql_create_unique_index = PGShareUpdateExclusive(
            "CREATE UNIQUE INDEX CONCURRENTLY %(name)s ON %(table)s (%(columns)s)%(condition)s",
            disable_statement_timeout=True
        )

and add null_distinct unit tests in tests/unit/test_schema.py

And also nice to add changes to CHANGES.md

tox.ini Outdated Show resolved Hide resolved
@browniebroke
Copy link
Contributor Author

Found the PRs where support for nulls distinct was added to Django:

I feel like I've tested only 1 of the 2 attributes, hoping to find some inspiration on how to test the other in these PRs.

Copy link
Owner

@tbicr tbicr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thanks

@tbicr tbicr merged commit 7228cc0 into tbicr:master Feb 21, 2024
1 check passed
@browniebroke browniebroke deleted the django-5.0 branch February 21, 2024 22:32
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

Successfully merging this pull request may close these issues.

2 participants