You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2022/10/18 20:04:30 UTC

[airflow] 02/05: Fix migration issue in upgrade using `type_` instead of `server_default` (#27009)

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

ephraimanierobi pushed a commit to branch v2-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 185c6ac3ad2e8d4841d561a9eb5b62c1294f83fb
Author: Ephraim Anierobi <sp...@gmail.com>
AuthorDate: Wed Oct 12 14:11:51 2022 +0100

    Fix migration issue in upgrade using `type_` instead of `server_default` (#27009)
    
    This was failing but was not noticed due to an issue with breeze.
    We should use `server_default` instead of `type_` since `sequence` is the default when table is described.
    The `type_` remains an integer with the added sequence
    
    (cherry picked from commit 1d132d50ddf6025a37ab7c136b5ce430fad60660)
---
 airflow/migrations/versions/0118_2_4_2_add_missing_autoinc_fab.py | 2 +-
 docs/apache-airflow/img/airflow_erd.sha256                        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/airflow/migrations/versions/0118_2_4_2_add_missing_autoinc_fab.py b/airflow/migrations/versions/0118_2_4_2_add_missing_autoinc_fab.py
index f6becd9dfe..69b0e231d1 100644
--- a/airflow/migrations/versions/0118_2_4_2_add_missing_autoinc_fab.py
+++ b/airflow/migrations/versions/0118_2_4_2_add_missing_autoinc_fab.py
@@ -67,7 +67,7 @@ def upgrade():
         with op.batch_alter_table(table) as batch:
             kwargs = {}
             if conn.dialect.name == 'postgresql':
-                kwargs['type_'] = sa.Sequence(f'{table}_id_seq').next_value()
+                kwargs['server_default'] = sa.Sequence(f'{table}_id_seq').next_value()
             else:
                 kwargs['autoincrement'] = True
             batch.alter_column("id", existing_type=sa.Integer(), existing_nullable=False, **kwargs)
diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256
index 1c82ebf2bf..da12a349e2 100644
--- a/docs/apache-airflow/img/airflow_erd.sha256
+++ b/docs/apache-airflow/img/airflow_erd.sha256
@@ -1 +1 @@
-030fee7fdf6b154b107a12331400a26843f4ebb4abaab84566aeca7c26d79450
\ No newline at end of file
+a522ff773bc6403318e4a15be19f25d48323208de3acc8a970f7f40ad4782563
\ No newline at end of file