Catch exception if sqlmigrate fails
Because of missing constraint that Django cannot find and therefore drop.
This commit is contained in:
1 parent
e408cd2c5e
commit
a74a7497ad
1 file changed
+18
-7
@@ -199,13 +199,24 @@ class MigrationLinter(object):
|
||||
"Calling sqlmigrate command {} {}".format(app_label, migration_name)
|
||||
)
|
||||
dev_null = open(os.devnull, "w")
|
||||
sql_statement = call_command(
|
||||
"sqlmigrate",
|
||||
app_label,
|
||||
migration_name,
|
||||
database=self.database,
|
||||
stdout=dev_null,
|
||||
)
|
||||
try:
|
||||
sql_statement = call_command(
|
||||
"sqlmigrate",
|
||||
app_label,
|
||||
migration_name,
|
||||
database=self.database,
|
||||
stdout=dev_null,
|
||||
)
|
||||
except ValueError:
|
||||
logger.warning(
|
||||
(
|
||||
"Error while executing sqlmigrate on (%s, %s). "
|
||||
"Continuing execution with empty SQL."
|
||||
),
|
||||
app_label,
|
||||
migration_name,
|
||||
)
|
||||
sql_statement = ""
|
||||
return sql_statement.splitlines()
|
||||
|
||||
def _gather_migrations_git(self, git_commit_id):
|
||||
|
||||
Reference in new issue
Block a user