diff options
Diffstat (limited to 'django/contrib/postgres/operations.py')
| -rw-r--r-- | django/contrib/postgres/operations.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/django/contrib/postgres/operations.py b/django/contrib/postgres/operations.py index be9ed9cb23..95e7edcdea 100644 --- a/django/contrib/postgres/operations.py +++ b/django/contrib/postgres/operations.py @@ -1,4 +1,6 @@ -from django.contrib.postgres.signals import register_type_handlers +from django.contrib.postgres.signals import ( + get_citext_oids, get_hstore_oids, register_type_handlers, +) from django.db.migrations.operations.base import Operation @@ -15,6 +17,9 @@ class CreateExtension(Operation): if schema_editor.connection.vendor != 'postgresql': return schema_editor.execute("CREATE EXTENSION IF NOT EXISTS %s" % schema_editor.quote_name(self.name)) + # Clear cached, stale oids. + get_hstore_oids.cache_clear() + get_citext_oids.cache_clear() # Registering new type handlers cannot be done before the extension is # installed, otherwise a subsequent data migration would use the same # connection. @@ -22,6 +27,9 @@ class CreateExtension(Operation): def database_backwards(self, app_label, schema_editor, from_state, to_state): schema_editor.execute("DROP EXTENSION %s" % schema_editor.quote_name(self.name)) + # Clear cached, stale oids. + get_hstore_oids.cache_clear() + get_citext_oids.cache_clear() def describe(self): return "Creates extension %s" % self.name |
