jedcunningham commented on code in PR #47592:
URL: https://github.com/apache/airflow/pull/47592#discussion_r1998979758
##########
airflow/migrations/versions/0050_3_0_0_add_dagbundlemodel.py:
##########
@@ -48,12 +49,32 @@ def upgrade():
sa.Column("last_refreshed", UtcDateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint("name", name=op.f("dag_bundle_pkey")),
)
+
with op.batch_alter_table("dag", schema=None) as batch_op:
batch_op.add_column(sa.Column("bundle_name", sa.String(length=250),
nullable=True))
batch_op.add_column(sa.Column("bundle_version", sa.String(length=200),
nullable=True))
+
batch_op.create_foreign_key(
batch_op.f("dag_bundle_name_fkey"), "dag_bundle", ["bundle_name"],
["name"]
)
+
+ conn = op.get_bind()
+ conn.execute(
+ text(
+ """
+ UPDATE dag
+ SET bundle_name =
+ CASE
+ WHEN fileloc LIKE '%/airflow/airflow/example_dags/%'
THEN 'example_dags'
+ ELSE 'dags-folder'
Review Comment:
This is fine. I think `dags-folder` will need to be our catch-all and we
will just document that you need a bundle with that name during the migration -
we have a FK to bundle, so it has to be a "real" value.
--
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]