Fixed #31615 -- Made migrations skip extension operations if not needed.

- Don't try to create an existing extension.
- Don't try to drop a nonexistent extension.
This commit is contained in:
Frantisek Holop 2020-05-22 11:40:34 +02:00 committed by Mariusz Felisiak
parent f3ed42c8ad
commit d693a086de
4 changed files with 54 additions and 6 deletions

View file

@ -30,12 +30,19 @@ For example::
...
]
Django checks that the extension already exists in the database and skips the
migration if so.
For most extensions, this requires a database user with superuser privileges.
If the Django database user doesn't have the appropriate privileges, you'll
have to create the extension outside of Django migrations with a user that has
them. In that case, connect to your Django database and run the query
``CREATE EXTENSION IF NOT EXISTS hstore;``.
.. versionchanged:: 3.2
In older versions, the existence of an extension isn't checked.
.. currentmodule:: django.contrib.postgres.operations
``CreateExtension``