Django migration app zero doesn't work

I’ve created a library to sync some data from Django models to the S3 bucket. But it is happening a bug whenever I run the CI and it unapplies the migrations.

This library creates a parent model called BaseSync, and the child models inherit the field updated_at. The problem happens when the CI runs the command ./ lakehouse_sync zero because the migration still shows as applied, but on the DB the table is deleted.

Then, when it tries to unapply the migration for the model, it raises the error:

django.db.utils.ProgrammingError: column "updated_at" of relation "recommendations_recommendationtraitcondition" does not exist

I just would like to know if someone has faced this error before, and how handled it.

The way that I’m using to work around it is adding a dependency to unapply first the migrations of the child models.

I’d start with trying to figure out what’s happening that it’s throwing the error django.db.utils.ProgrammingError: column "updated_at" of relation "recommendations_recommendationtraitcondition" does not exist.

  • Do any migrations have a dependency on a lakehouse_sync migration?
  • What is happening that is causing RecommendationTraitCondition.updated_at to be used? A stacktrace here will be helpful.