summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/backends/base/schema.py2
-rw-r--r--tests/migrations/test_operations.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py
index ef915c311b..4998a3fe2e 100644
--- a/django/db/backends/base/schema.py
+++ b/django/db/backends/base/schema.py
@@ -135,7 +135,7 @@ class BaseDatabaseSchemaEditor:
# Log the command we're running, then run it
logger.debug("%s; (params %r)", sql, params, extra={'params': params, 'sql': sql})
if self.collect_sql:
- ending = "" if sql.endswith(";") else ";"
+ ending = "" if sql.rstrip().endswith(";") else ";"
if params is not None:
self.collected_sql.append((sql % tuple(map(self.quote_value, params))) + ending)
else:
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index 3070aece2b..09c11e97db 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -3007,6 +3007,7 @@ class OperationTests(OperationTestBase):
project_state = self.set_up_test_model('test_runsql')
new_state = project_state.clone()
tests = [
+ 'INSERT INTO test_runsql_pony (pink, weight) VALUES (1, 1);\n',
'INSERT INTO test_runsql_pony (pink, weight) VALUES (1, 1)\n',
]
for sql in tests: