#6148: Add generic support for database schemas
-------------------------------------+-------------------------------------
Reporter: ikelly | Owner: akaariai
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: oracle postgresql | Needs documentation: 1
mysql schemas | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by schinckel):
Replying to [comment:155 akaariai]:
> It would also be possible to use a dynamic schema if wanted (just
implement a custom Table class that changes the schema dynamically), but
Django wouldn't officially support dynamic schemas. The simple reason is
that nobody is ever going to implement delete cascades for dynamic
schemas. Also, multi-schema migrations seem like too hard of a problem to
solve.
Multi-schema migrations are indeed a hard problem to solve. I think I have
a fairly workable solution in place now (Postgres only), at https
://django-boardinghouse.readthedocs.org/
My approach is a multi-tenancy approach (with some shared tables: usually
the user table, the tenant table, and perhaps others), and requires that
for all non-shared models, every migration operation that appears to be
running on one of those models should be applied to each tenant schema in
turn.
In practice, this makes migrations quite slow, even for small numbers of
schemata. However, it does allow cross schema relations.
It uses setting the search path rather than explicitly including the
schema name in the model.
--
Ticket URL: <https://code.djangoproject.com/ticket/6148#comment:159>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.22258c622a9910a275e4166a3ba1c4d6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.