The SQL output needs to be returned

This commit is contained in:
tcely 2025-05-04 13:13:23 -04:00 committed by GitHub
parent da06a1ffa1
commit a59fb8bc26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -242,13 +242,12 @@ class Command(BaseCommand):
None,
)
if not options['dry_run']:
if options['dry_run']:
return '\n'.join(schema.collected_sql)
else:
with db.connection.schema_editor(collect_sql=False) as schema_editor:
for sql in schema.collected_sql:
schema_editor.execute(sql, None)
else:
for sql in schema.collected_sql:
self.stdout.write(sql)
# All done