Skip to content

DB downgrade does not downgrade correctly autoincrement column #65000

@romanzdk

Description

@romanzdk

Under which category would you file this issue?

Airflow Core

Apache Airflow version

3.2.0

What happened and how to reproduce it?

We updated Airflow from 3.1.8 to 3.2.0. Webservers started to stuck and it was totally unusable. So we reverted back to 3.1.8 via airflow db downgrade --to-version 3.1.8 which was successfull and everything seemed fine. However we started seeing an error in scheduler like:

...
sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "id" of relation "callback_request" violates not-null constraint

And after some investigation we found out that there was this migration that changed the type of the ID column of the callback_request table, however, downgrade did not return the autoincrement back. The field is now integer (correct) but sequence for autoincrement is totally missing and then we see these errors. It seems downgrade migration should look differently.

What you think should happen instead?

Autoincrement for the ID column of the callback_request table returned correctly.

Operating System

No response

Deployment

None

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

No response

Official Helm Chart version

Not Applicable

Kubernetes Version

No response

Helm Chart configuration

No response

Docker Image customizations

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions