#31347: Router support for CreateExtension operations
----------------------------------------+------------------------
               Reporter:  Petr Přikryl  |          Owner:  nobody
                   Type:  Bug           |         Status:  new
              Component:  Migrations    |        Version:  2.1
               Severity:  Normal        |       Keywords:
           Triage Stage:  Unreviewed    |      Has patch:  0
    Needs documentation:  0             |    Needs tests:  0
Patch needs improvement:  0             |  Easy pickings:  0
                  UI/UX:  0             |
----------------------------------------+------------------------
 Hi, I have problem migrating some 3rd party database with Django
 migrations. I have used router for controlling which apps are allowed to
 be migrated on this database. But I have problem with **HStoreExtension**
 operation because these operations don't check if they are allowed. And
 because I have limited rights and I am controlling only my schema on that
 database I will get error while installing hstore.

 Source of trouble:
 
https://github.com/django/django/blob/master/django/contrib/postgres/operations.py#L18

 Work-around/proposal for CreateExtension class:
 {{{
 class RoutingHStoreExtension(HStoreExtension):
     def database_forwards(self, app_label, schema_editor, from_state,
 to_state):
         if not router.allow_migrate(schema_editor.connection.alias,
 app_label):
             return
         return super().database_forwards(app_label, schema_editor,
 from_state, to_state)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31347>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.c3231df409595de6c60e2ed6b3453332%40djangoproject.com.

Reply via email to