| 21 | pass |
| 22 | |
| 23 | def database_forwards(self, app_label, schema_editor, from_state, to_state): |
| 24 | if schema_editor.connection.vendor != "postgresql" or not router.allow_migrate( |
| 25 | schema_editor.connection.alias, app_label, **self.hints |
| 26 | ): |
| 27 | return |
| 28 | if not self.extension_exists(schema_editor, self.name): |
| 29 | schema_editor.execute( |
| 30 | "CREATE EXTENSION IF NOT EXISTS %s" |
| 31 | % schema_editor.quote_name(self.name) |
| 32 | ) |
| 33 | # Clear cached, stale oids. |
| 34 | get_hstore_oids.cache_clear() |
| 35 | get_citext_oids.cache_clear() |
| 36 | # Registering new type handlers cannot be done before the extension is |
| 37 | # installed, otherwise a subsequent data migration would use the same |
| 38 | # connection. |
| 39 | register_type_handlers(schema_editor.connection) |
| 40 | if hasattr(schema_editor.connection, "register_geometry_adapters"): |
| 41 | schema_editor.connection.register_geometry_adapters( |
| 42 | schema_editor.connection.connection, True |
| 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( |