This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 4f6d597358 Ensure include_deferred is not nullable (#33280)
4f6d597358 is described below

commit 4f6d5973589577ffcb7db24c82dd6708b2c00023
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Thu Aug 10 19:13:48 2023 +0800

    Ensure include_deferred is not nullable (#33280)
    
    * Ensure include_deferred is not nullable
    
    This uses a multi-step process to introduce the NOT NULL constraint to
    the column, needed due to MSSQL restrictions.
    
    * MSSQL does not even support boolean literals
    
    * Postgres does not support 0 as boolean
    
    This is fine. SQL is fun.
    
    * Wrap raw SQL in text()
---
 .../versions/0128_2_7_0_add_include_deferred_column_to_pool.py    | 6 +++++-
 docs/apache-airflow/img/airflow_erd.sha256                        | 2 +-
 docs/apache-airflow/img/airflow_erd.svg                           | 8 ++++----
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git 
a/airflow/migrations/versions/0128_2_7_0_add_include_deferred_column_to_pool.py 
b/airflow/migrations/versions/0128_2_7_0_add_include_deferred_column_to_pool.py
index bbafc68057..9e00027670 100644
--- 
a/airflow/migrations/versions/0128_2_7_0_add_include_deferred_column_to_pool.py
+++ 
b/airflow/migrations/versions/0128_2_7_0_add_include_deferred_column_to_pool.py
@@ -39,7 +39,11 @@ airflow_version = "2.7.0"
 def upgrade():
     """Apply add include_deferred column to pool"""
     with op.batch_alter_table("slot_pool") as batch_op:
-        batch_op.add_column(sa.Column("include_deferred", sa.Boolean, 
default=False))
+        batch_op.add_column(sa.Column("include_deferred", sa.Boolean))
+    # Different databases support different literal for FALSE. This is fine.
+    op.execute(sa.text(f"UPDATE slot_pool SET include_deferred = 
{sa.false().compile(op.get_bind())}"))
+    with op.batch_alter_table("slot_pool") as batch_op:
+        batch_op.alter_column("include_deferred", existing_type=sa.Boolean, 
nullable=False)
 
 
 def downgrade():
diff --git a/docs/apache-airflow/img/airflow_erd.sha256 
b/docs/apache-airflow/img/airflow_erd.sha256
index a7704c8fc5..0594dd21e8 100644
--- a/docs/apache-airflow/img/airflow_erd.sha256
+++ b/docs/apache-airflow/img/airflow_erd.sha256
@@ -1 +1 @@
-52b0e45032fb1c60274374e0114cf199dfb759adc0a4fe32964136347457506a
\ No newline at end of file
+266a8533dca6d9c7e984341bfe29e99f29217e44529455a49e7c4a5faccdcdf3
\ No newline at end of file
diff --git a/docs/apache-airflow/img/airflow_erd.svg 
b/docs/apache-airflow/img/airflow_erd.svg
index ba548c60fd..8bf922245e 100644
--- a/docs/apache-airflow/img/airflow_erd.svg
+++ b/docs/apache-airflow/img/airflow_erd.svg
@@ -1228,28 +1228,28 @@
 <g id="edge48" class="edge">
 <title>task_instance&#45;&#45;xcom</title>
 <path fill="none" stroke="#7f7f7f" stroke-dasharray="5,2" 
d="M1166.17,-482.51C1190.54,-462.01 1215.43,-441.43 1239,-422 1245.31,-416.8 
1251.76,-411.48 1258.29,-406.14"/>
-<text text-anchor="start" x="1227.29" y="-394.94" font-family="Times,serif" 
font-size="14.00">0..N</text>
+<text text-anchor="start" x="1248.29" y="-394.94" font-family="Times,serif" 
font-size="14.00">1</text>
 <text text-anchor="start" x="1166.17" y="-471.31" font-family="Times,serif" 
font-size="14.00">1</text>
 </g>
 <!-- task_instance&#45;&#45;xcom -->
 <g id="edge49" class="edge">
 <title>task_instance&#45;&#45;xcom</title>
 <path fill="none" stroke="#7f7f7f" stroke-dasharray="5,2" 
d="M1166.17,-500.3C1190.54,-480.01 1215.43,-459.43 1239,-440 1245.31,-434.8 
1251.76,-429.48 1258.29,-424.12"/>
-<text text-anchor="start" x="1248.29" y="-412.92" font-family="Times,serif" 
font-size="14.00">1</text>
+<text text-anchor="start" x="1227.29" y="-412.92" font-family="Times,serif" 
font-size="14.00">0..N</text>
 <text text-anchor="start" x="1166.17" y="-489.1" font-family="Times,serif" 
font-size="14.00">1</text>
 </g>
 <!-- task_instance&#45;&#45;xcom -->
 <g id="edge50" class="edge">
 <title>task_instance&#45;&#45;xcom</title>
 <path fill="none" stroke="#7f7f7f" stroke-dasharray="5,2" 
d="M1166.17,-518.08C1190.54,-498.01 1215.43,-477.43 1239,-458 1246.11,-452.14 
1253.42,-446.12 1260.79,-440.05"/>
-<text text-anchor="start" x="1229.79" y="-443.85" font-family="Times,serif" 
font-size="14.00">0..N</text>
+<text text-anchor="start" x="1250.79" y="-443.85" font-family="Times,serif" 
font-size="14.00">1</text>
 <text text-anchor="start" x="1166.17" y="-506.88" font-family="Times,serif" 
font-size="14.00">1</text>
 </g>
 <!-- task_instance&#45;&#45;xcom -->
 <g id="edge51" class="edge">
 <title>task_instance&#45;&#45;xcom</title>
 <path fill="none" stroke="#7f7f7f" stroke-dasharray="5,2" 
d="M1166.17,-535.87C1190.54,-516.01 1215.43,-495.43 1239,-476 1252.96,-464.49 
1267.64,-452.42 1282.18,-440.26"/>
-<text text-anchor="start" x="1272.18" y="-444.06" font-family="Times,serif" 
font-size="14.00">1</text>
+<text text-anchor="start" x="1282.18" y="-444.06" font-family="Times,serif" 
font-size="14.00">0..N</text>
 <text text-anchor="start" x="1166.17" y="-524.67" font-family="Times,serif" 
font-size="14.00">1</text>
 </g>
 <!-- log_template -->

Reply via email to