Skip to content

Commit

Permalink
fixup! fixup! fix for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimbuddy committed Nov 24, 2024
1 parent 7dc1245 commit 47128e9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ def downgrade():
with op.batch_alter_table("task_outlet_dataset_reference", schema=None) as batch_op:
batch_op.alter_column("asset_id", new_column_name="dataset_id", type_=sa.Integer(), nullable=False)

# batch_op.drop_constraint("toar_asset_fkey", type_="foreignkey")
batch_op.drop_constraint("toar_dag_id_fkey", type_="foreignkey")

_rename_index(
Expand Down Expand Up @@ -586,7 +585,6 @@ def downgrade():
with op.batch_alter_table("dataset_dag_run_queue", schema=None) as batch_op:
batch_op.alter_column("asset_id", new_column_name="dataset_id", type_=sa.Integer(), nullable=False)

# batch_op.drop_constraint("adrq_asset_fkey", type_="foreignkey")
batch_op.drop_constraint("adrq_dag_fkey", type_="foreignkey")

_rename_pk_constraint(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def upgrade():

def downgrade():
"""Unapply add dag versioning."""
_delete_serdag_and_code()
with op.batch_alter_table("task_instance_history", schema=None) as batch_op:
batch_op.drop_column("dag_version_id")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def upgrade():
op.execute(
"""
ALTER TABLE xcom
ALTER COLUMN value TYPE JSON
ALTER COLUMN value TYPE JSONB
USING CASE
WHEN value IS NOT NULL THEN CAST(CONVERT_FROM(value, 'UTF8') AS JSON)
WHEN value IS NOT NULL THEN CAST(CONVERT_FROM(value, 'UTF8') AS JSONB)
ELSE NULL
END
"""
Expand Down Expand Up @@ -136,7 +136,6 @@ def upgrade():
# Drop the old `value_old` column
with op.batch_alter_table("xcom", schema=None) as batch_op:
batch_op.drop_column("value_old")
op.drop_table("_xcom_archive")


def downgrade():
Expand Down Expand Up @@ -181,3 +180,5 @@ def downgrade():

with op.batch_alter_table("xcom", schema=None) as batch_op:
batch_op.drop_column("value_old")

op.drop_table("_xcom_archive", if_exists=True)
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 @@
a81bc0639419e66abacc09d95177df593b10d8944708212ea2a96a51070b7b31
65f26e091cabd5c67f45abb682d1ef4fe63cd0d701b5729e5cf95d9cf2599c6a
2 changes: 2 additions & 0 deletions tests/utils/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def test_database_schema_and_sqlalchemy_model_are_in_sync(self):
lambda t: (t[0] == "remove_table" and t[1].name == "sqlite_sequence"),
# fab version table
lambda t: (t[0] == "remove_table" and t[1].name == "alembic_version_fab"),
# Ignore _xcom_archive table
lambda t: (t[0] == "remove_table" and t[1].name == "_xcom_archive"),
]

for ignore in ignores:
Expand Down

0 comments on commit 47128e9

Please sign in to comment.