#31383: Make createcachetable use SchemaEditor for SQL generation
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* stage: Unreviewed => Accepted
Comment:
It's a shame that the schema editor cannot operate on model states and
requires the creation of a temporary model here.
You'll want to use a throw away `apps` instead of a `dummy` app name,
here's how the schema recorder does it
https://github.com/django/django/blob/c1c361677d9400c8e2cdaddda0c16086bb358492/django/db/migrations/recorder.py#L30-L43
In order to address `Executing DDL statements while in a transaction on
databases that can't perform a rollback is prohibited.` you should remove
the outer `atomic` block and let `SchemaEditor`
[https://github.com/django/django/blob/c1c361677d9400c8e2cdaddda0c16086bb358492/django/db/backends/base/schema.py#L101
handle it] if it's allowed by the underlying backend.
--
Ticket URL: <https://code.djangoproject.com/ticket/31383#comment:2>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.14b33d435e000d524a5b5ae935b43446%40djangoproject.com.