| 43 | ) |
| 44 | |
| 45 | def database_backwards(self, app_label, schema_editor, from_state, to_state): |
| 46 | if schema_editor.connection.vendor != "postgresql" or not router.allow_migrate( |
| 47 | schema_editor.connection.alias, app_label, **self.hints |
| 48 | ): |
| 49 | return |
| 50 | if self.extension_exists(schema_editor, self.name): |
| 51 | schema_editor.execute( |
| 52 | "DROP EXTENSION IF EXISTS %s" % schema_editor.quote_name(self.name) |
| 53 | ) |
| 54 | # Clear cached, stale oids. |
| 55 | get_hstore_oids.cache_clear() |
| 56 | get_citext_oids.cache_clear() |
| 57 | |
| 58 | def extension_exists(self, schema_editor, extension): |
| 59 | with schema_editor.connection.cursor() as cursor: |