From c679cb7f600b13646a1a2b5fc8a03dfcc2e413f2 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Fri, 28 Feb 2014 13:14:09 +0100 Subject: Fixed #22168 -- Fixed migrations failing on sqlite when column names are SQL keywords Thanks to trac user fallen_flint for the report and initial patch. --- django/db/backends/sqlite3/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'django') diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py index 279ac4b203..e8fc2635d1 100644 --- a/django/db/backends/sqlite3/schema.py +++ b/django/db/backends/sqlite3/schema.py @@ -83,8 +83,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): field_maps = list(mapping.items()) self.execute("INSERT INTO %s (%s) SELECT %s FROM %s" % ( self.quote_name(temp_model._meta.db_table), - ', '.join(x for x, y in field_maps), - ', '.join(y for x, y in field_maps), + ', '.join(self.quote_name(x) for x, y in field_maps), + ', '.join(self.quote_name(y) for x, y in field_maps), self.quote_name(model._meta.db_table), )) # Delete the old table -- cgit v1.3