Chais opened a new issue, #57422:
URL: https://github.com/apache/airflow/issues/57422

   ### Apache Airflow version
   
   Other Airflow 2/3 version (please specify below)
   
   ### If "Other Airflow 2/3 version" selected, which one?
   
   3.0.2
   
   ### What happened?
   
   I wanted to upgrade our 2.10.5 to 2.11.0 but neglected to add `--version 
1.16.0` to `helm upgrade`, which resulted in it using the 1.18.0 chart. It ran 
the DB migrations to 3.0.2.  
   I'm now stuck trying to downgrade the DB back to 2.10.5, but get the 
following error:
   ```
   sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) column 
"task_instance_id" of relation "task_instance_history" contains null values
   ```
   which would be fine if it were actually true. I went into the shell to check:
   ```
   airflow_db=> select count(*) from task_instance_history;
    count 
   -------
     4450
   (1 row)
   
   airflow_db=> select count(*) from task_instance_history where 
task_instance_id is null;
    count 
   -------
        0
   (1 row)
   
   airflow_db=> select count(*) from task_instance_history where 
task_instance_id is not null;
    count 
   -------
     4450
   (1 row)
   ```
   So I'm not sure what Alembic is complaining about.
   
   ### What you think should happen instead?
   
   The migration 2 → 3 worked fine, so the reverse should work, as well.
   
   ### How to reproduce
   
   I don't think k8s has anything to do with this, so `airflow standalone` 
should do the trick. Just set up a 2.10.5 and upgrade to 3.0.2. A postgres DB 
might be necessary, though.  
   Having some entries in `task_instance_history` may be helpful.
   
   ### Operating System
   
   Worker runs Debian 12, host runs CentOS 7
   
   ### Versions of Apache Airflow Providers
   
   ```
   apache-airflow-providers-common-sql==1.27.1
   apache-airflow-providers-postgres==6.2.0
   ```
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   ```
   helm version
   version.BuildInfo{Version:"v3.17.2", 
GitCommit:"cc0bbbd6d6276b83880042c1ecb34087e84d41eb", GitTreeState:"clean", 
GoVersion:"go1.23.7"}
   ```
   Extended image:
   ```dockerfile
   FROM apache/airflow:slim-2.11.0-python3.12
   
   USER root
   RUN apt-get update \
       && apt-get install -y --no-install-recommends \
           libkrb5-dev \
           htop \
       && apt-get autoremove -yqq --purge \
       && apt-get clean \
       && rm -rf /var/lib/apt/lists/*
   
   USER airflow
   RUN pip install --no-cache-dir python-socks 
apache-airflow[celery,imap,postgres,samba,sftp,ssh,statsd,tableau]==${AIRFLOW_VERSION}
 elasticsearch presto-python-client confluent-kafka
   
   USER root
   ```
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to