#31383: Make createcachetable use SchemaEditor for SQL generation
-------------------------------------+-------------------------------------
Reporter: Tim | Owner: nobody
Graham |
Type: | Status: new
Cleanup/optimization |
Component: Core | Version: master
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The createcachetable management command
[https://github.com/django/django/blob/c1c361677d9400c8e2cdaddda0c16086bb358492/django/core/management/commands/createcachetable.py#L65-L87
generates its SQL manually]. The generated SQL:
{{{ #!sql
CREATE TABLE test_cache_table (
cache_key STRING(255) NOT NULL PRIMARY KEY,
value STRING(MAX) NOT NULL,
expires TIMESTAMP NOT NULL
)
}}}
is incompatible with Google's Cloud Spanner databases, which requires a
different PRIMARY KEY syntax:
{{{ #!sql
CREATE TABLE test_cache_table (
cache_key STRING(255) NOT NULL,
value STRING(MAX) NOT NULL,
expires TIMESTAMP NOT NULL
) PRIMARY KEY (cache_key)
}}}
This issue wouldn't happen if the management command used
`SchemaEditor.create_model()` for SQL generation.
--
Ticket URL: <https://code.djangoproject.com/ticket/31383>
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/052.4782d7a99f6ae1adf5a6826c60de8c62%40djangoproject.com.