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

   ### Apache Airflow version
   
   2.5.3
   
   ### What happened
   
   upgrade an empty sqlite 1.10.15 airflow database to 2.5.3 fail
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   ```shell
   export AIRFLOW_HOME=~/airflow
   
   airflow version
   ```
   
   log```
   1.10.15
   ```
   
   ```shell
   airflow db init
   ```
   
   ```log
   INFO  [alembic.runtime.migration] Running upgrade 92c57b58940d -> 
03afc6b6f902, Increase length of FAB ab_view_menu.name column
   Done.
   ```
   
   ```shell
   pip install "apache-airflow==2.5.3" --constraint 
"https://raw.githubusercontent.com/apache/airflow/constraints-2.5.3/constraints-3.10.txt";
   
   airflow version
   ```
   
   ```log
   2.5.3
   ```
   
   ```shell
   airflow db upgrade
   ```
   
   ```log
   INFO  [alembic.runtime.migration] Running upgrade 1de7bc13c950 -> 
3c94c427fdf6, Add cascade to dag_tag foreign key
   Traceback (most recent call last):
     File 
"/home/XX/venv/lib/python3.10/site-packages/alembic/operations/batch.py", line 
689, in drop_constraint
       const = self.named_constraints.pop(const.name)
   KeyError: 'dag_tag__fkey'
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/home/XX/venv/bin/airflow", line 8, in <module>
       sys.exit(main())
     File "/home/XX/venv/lib/python3.10/site-packages/airflow/__main__.py", 
line 48, in main
       args.func(args)
     File 
"/home/XX/venv/lib/python3.10/site-packages/airflow/cli/cli_parser.py", line 
52, in command
       return func(*args, **kwargs)
     File "/home/XX/venv/lib/python3.10/site-packages/airflow/utils/cli.py", 
line 108, in wrapper
       return f(*args, **kwargs)
     File 
"/home/XX/venv/lib/python3.10/site-packages/airflow/cli/commands/db_command.py",
 line 84, in upgradedb
       db.upgradedb(
     File 
"/home/XX/venv/lib/python3.10/site-packages/airflow/utils/session.py", line 75, 
in wrapper
       return func(*args, session=session, **kwargs)
     File "/home/XX/venv/lib/python3.10/site-packages/airflow/utils/db.py", 
line 1578, in upgradedb
       command.upgrade(config, revision=to_revision or "heads")
     File "/home/XX/venv/lib/python3.10/site-packages/alembic/command.py", line 
378, in upgrade
       script.run_env()
     File "/home/XX/venv/lib/python3.10/site-packages/alembic/script/base.py", 
line 576, in run_env
       util.load_python_file(self.dir, "env.py")
     File "/home/XX/venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", 
line 94, in load_python_file
       module = load_module_py(module_id, path)
     File "/home/XX/venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", 
line 110, in load_module_py
       spec.loader.exec_module(module)  # type: ignore
     File "<frozen importlib._bootstrap_external>", line 883, in exec_module
     File "<frozen importlib._bootstrap>", line 241, in 
_call_with_frames_removed
     File 
"/home/XX/venv/lib/python3.10/site-packages/airflow/migrations/env.py", line 
117, in <module>
       run_migrations_online()
     File 
"/home/XX/venv/lib/python3.10/site-packages/airflow/migrations/env.py", line 
111, in run_migrations_online
       context.run_migrations()
     File "<string>", line 8, in run_migrations
     File 
"/home/XX/venv/lib/python3.10/site-packages/alembic/runtime/environment.py", 
line 867, in run_migrations
       self.get_context().run_migrations(**kw)
     File 
"/home/XX/venv/lib/python3.10/site-packages/alembic/runtime/migration.py", line 
624, in run_migrations
       step.migration_fn(**kw)
     File 
"/home/XX/venv/lib/python3.10/site-packages/airflow/migrations/versions/0110_2_3_2_add_cascade_to_dag_tag_foreignkey.py",
 line 46, in upgrade
       with op.batch_alter_table(
     File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
       next(self.gen)
     File 
"/home/XX/venv/lib/python3.10/site-packages/alembic/operations/base.py", line 
383, in batch_alter_table
       impl.flush()
     File 
"/home/XX/venv/lib/python3.10/site-packages/alembic/operations/batch.py", line 
159, in flush
       fn(*arg, **kw)
     File 
"/home/XX/venv/lib/python3.10/site-packages/alembic/operations/batch.py", line 
700, in drop_constraint
       raise ValueError("No such constraint: '%s'" % const.name)
   ValueError: No such constraint: 'dag_tag__fkey'
   ```
   
   ### Operating System
   
   ubuntu 22.04
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### 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