ephraimbuddy commented on a change in pull request #21962:
URL: https://github.com/apache/airflow/pull/21962#discussion_r818512652



##########
File path: airflow/utils/db.py
##########
@@ -1074,9 +1073,10 @@ def _validate_version_range(command, config, 
version_range):
         raise AirflowException(
             'MSSQL is not supported for offline migration in Airflow versions 
less than 2.2.0.'
         )
-    revision = f"{REVISION_HEADS_MAP[lower]}:{REVISION_HEADS_MAP[upper]}"
+    _lower, _upper = REVISION_HEADS_MAP[lower], REVISION_HEADS_MAP[upper]
+    revision = f"{_lower}:{_upper}"
     try:
-        command.history(config, rev_range=revision)
+        list(script_.revision_map.iterate_revisions(_upper, _lower))

Review comment:
       Currently, if you run the `airflow db upgrade --range 2.0.0:2.2.3` it 
prints migration history before printing the SQL. Something like this:
   ```
   64a7d6477aae -> e959f08ac86c, Change field in ``DagCode`` to ``MEDIUMTEXT`` 
for MySql
   30867afad44a -> 54bebd308c5f, Adds ``trigger`` table and deferrable operator 
columns to task instance
   e9304a3141f0 -> 30867afad44a, Rename ``concurrency`` column in ``dag`` table 
to`` max_active_tasks``
   83f031fd9f1c -> e9304a3141f0, Make XCom primary key columns non-nullable
   ccde3e26fe78 -> 83f031fd9f1c, Improve MSSQL compatibility
   092435bf5d12 -> ccde3e26fe78, Add index on state, dag_id for queued 
``dagrun``
   ```
   So the above code does this internally and does not print the history. 




-- 
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