Asked 4 months ago by JovianWayfarer663
How can I prevent Django from creating an index during the initial migration for CrateDB?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 4 months ago by JovianWayfarer663
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I'm developing a driver for CrateDB, which indexes everything by default and does not support adding a new index after table creation. However, the initial migration (sessions.0001_initial) attempts to run the following command:
PYTHONCREATE INDEX "django_session_expire_date_a5c62663" ON "django_session" ("expire_date")
I tried to disable index creation by modifying my backend features and schema editor as shown below:
PYTHONclass DatabaseFeatures(BaseDatabaseFeatures): # Does the backend support partial indexes (CREATE INDEX ... WHERE ...)? supports_partial_indexes = False supports_functions_in_partial_indexes = False # Does the backend support indexes on expressions? supports_expression_indexes = False
PYTHONclass DatabaseSchemaEditor(BaseDatabaseSchemaEditor): def add_index(self, model, index): return () def add_constraint(self, model, constraint): return ()
Despite these changes, Django still issues the CREATE INDEX command. How can I stop Django from generating this statement without resorting to hacks like setting sql_create_index = ("select 1")
?
Thanks in advance.
Comments 0
•Answers 0
•Views 138
No comments yet.