zach-overflow commented on PR #59239:
URL: https://github.com/apache/airflow/pull/59239#issuecomment-3697382607

   I've compared the actual migration SQL statements between the modified 
`0015_2_9_0_update_trigger_kwargs_type.py`  script in this PR and the script 
from `main`. It appears that the sql output is identical, so I think modifying 
that migration script retroactively is likely the best option forward cc 
@potiuk @jscheffl  . Comparison details below:
   
   ## Comparing Downgrades
   
   Migrate from 
[bff083ad727d](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/migrations/versions/0016_2_9_2_remove_idx_last_scheduling_decision_.py)
 (in `2.9.2`) → 
[ee1467d4aa35](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/migrations/versions/0014_2_9_0_add_display_name_for_dag_and_task_.py)
 (in `2.9.0`, rev preceding trigger kwarg encryption)
   
   ```shell
   export DOWNGRADE_CHECK="airflow db downgrade \
       --from-revision bff083ad727d \
       --to-revision ee1467d4aa35 \
       --show-sql-only"
   ```
   
   1. Using unmodified `0015_2_9_0_update_trigger_kwargs_type.py` checked out 
from `main` on this branch
       ```shell
          # Checkout the current migration script from main (unmodified)
           git checkout origin/main -- 
airflow-core/src/airflow/migrations/versions/0015_2_9_0_update_trigger_kwargs_type.py
           breeze shell "${DOWNGRADE_CHECK}" --use-airflow-version 2.10.0 
--airflow-extras pydantic --answer y
       ```
   
   2. Using the modified migration script from this current PR:
       ```shell
       # Restore to current modified script
       git restore --staged 
airflow-core/src/airflow/migrations/versions/0015_2_9_0_update_trigger_kwargs_type.py
       git restore 
airflow-core/src/airflow/migrations/versions/0015_2_9_0_update_trigger_kwargs_type.py
       breeze shell "${DOWNGRADE_CHECK}" --use-airflow-version 2.10.0 
--airflow-extras pydantic --answer y
       ```
   
   Relevant SQL Output for **both** breeze downgrade commands 1 and 2:
   
   ```
   ------------
   --  WARNING: Unable to decrypt trigger kwargs automatically in offline mode!
   --  If any trigger rows exist when you do an offline downgrade, the 
migration will fail.
   ------------
   
   ALTER TABLE trigger ALTER COLUMN kwargs TYPE JSON USING kwargs::json;
   
   UPDATE alembic_version SET version_num='ee1467d4aa35' WHERE 
alembic_version.version_num = '1949afb29106';
   ```
   
   ## Comparing Upgrades
   
   Migrate from 
[10b52ebd31f7](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/migrations/versions/0007_2_8_0_add_processor_subdir_import_error.py)
 (in `2.8.0`) → 
[22ed7efa9da2](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/migrations/versions/0026_2_10_0_dag_schedule_dataset_alias_reference.py)
 (`2.10.0`)
   
   ```shell
   export UPGRADE_CHECK="airflow db reset \
       --skip-init -y \
       && airflow db migrate \
       --from-revision 10b52ebd31f7 \
       --to-revision heads \
       --show-sql-only"
   ```
   
   1. Using unmodified `0015_2_9_0_update_trigger_kwargs_type.py` checked out 
from `main` on this branch
       ```shell
          # Checkout the current migration script from main (unmodified)
           git checkout origin/main -- 
airflow-core/src/airflow/migrations/versions/0015_2_9_0_update_trigger_kwargs_type.py
           breeze shell "${UPGRADE_CHECK}" --use-airflow-version 2.10.0 
--airflow-extras pydantic --answer y
       ```
   
   2. Using the modified migration script from this current PR:
       ```shell
       # Restore to current modified script
       git restore --staged 
airflow-core/src/airflow/migrations/versions/0015_2_9_0_update_trigger_kwargs_type.py
       git restore 
airflow-core/src/airflow/migrations/versions/0015_2_9_0_update_trigger_kwargs_type.py
       breeze shell "${UPGRADE_CHECK}" --use-airflow-version 2.10.0 
--airflow-extras pydantic --answer y
       ```
   
   Relevant SQL Output for **both** breeze upgrade commands 1 and 2:
   
   ```
   -- Running upgrade ee1467d4aa35 -> 1949afb29106
   
   ALTER TABLE trigger ALTER COLUMN kwargs TYPE TEXT;
   
   UPDATE alembic_version SET version_num='1949afb29106' WHERE 
alembic_version.version_num = 'ee1467d4aa35';
   ```


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