zach-overflow opened a new pull request, #60176:
URL: https://github.com/apache/airflow/pull/60176

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   Closes: https://github.com/apache/airflow/issues/59871
   
   ## What?
   * Adds a new pre-commit check for airflow-core to prevent improper 
references of ORM definitions within alembic migration scripts.
   
   ## Why?
   * See linked issue for further details. TL;DR: Direct usage of ORM 
definitions in migration scripts are not guaranteed to remain compatible in the 
future, particularly for downgrades.
   
   ## Testing
   * Ensured the current state of `main` passes the new pre-commit check
   * Checked out the state of the most recent migration script with a bad 
reference and ran the checks to ensure it failed as expected:
       ```shell
       git checkout 243fe86d4b3e59bb12977b3e36ca3f2ed27ca0f8 -- 
airflow-core/src/airflow/migrations/versions/0015_2_9_0_update_trigger_kwargs_type.py
       prek run --hook-stage pre-push 
airflow-core:check-no-orm-refs-in-migration-scripts
       ```
       which led to the following:
       
       <img width="1184" height="157" alt="Screenshot 2026-01-06 at 11 47 09 
AM" 
src="https://github.com/user-attachments/assets/2ddc3cc4-7b48-4ab8-bed9-daba26f0b11a";
 />
   


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