Open rominf opened 6 years ago
@rominf this is very necroposty of me, but did you find a solution which would be better than this?
try:
migrator.add_columns(
model=DBCampaign,
state_machine_arn=DBCampaign.state_machine_arn,
)
except ProgrammingError as err:
if str(err).endswith('already exists'):
logger.info('Skipping adding a column that already exists: %s', err)
else:
raise
Even if I did, I don't remember it.
I see. Thanks for replying!
I have a model with a few fields. In the next version of my program, I want to add another field. I add it to the model class and write a migration with
migrator.add_fields
call. Everything is fine if I run the program with an empty database or if I migrate the database from the previous version. But I run migrations on the database of the last version which had no migrations I get the exception:How do I handle this situation? Is there any way to suppress the exception or to check the field existence without executing SQL (I want my migrations to be DBMS independent)?