Skip to content

Commit

Permalink
Fix migration issue in upgrade using type_ instead of `server_defau…
Browse files Browse the repository at this point in the history
…lt` (#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 1d132d5)
  • Loading branch information
ephraimbuddy committed Oct 18, 2022
1 parent 7f48924 commit e4b87ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow/img/airflow_erd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
030fee7fdf6b154b107a12331400a26843f4ebb4abaab84566aeca7c26d79450
a522ff773bc6403318e4a15be19f25d48323208de3acc8a970f7f40ad4782563

0 comments on commit e4b87ba

Please sign in to comment.