rusackas commented on code in PR #41126:
URL: https://github.com/apache/superset/pull/41126#discussion_r3450206418


##########
superset/tags/models.py:
##########
@@ -111,12 +111,14 @@ class TaggedObject(Model, AuditMixinNullable):
     __tablename__ = "tagged_object"
     id = Column(Integer, primary_key=True)
     tag_id = Column(Integer, ForeignKey("tag.id"))
-    object_id = Column(
-        Integer,
-        ForeignKey("dashboards.id"),
-        ForeignKey("slices.id"),
-        ForeignKey("saved_query.id"),
-    )
+    # ``object_id`` is a polymorphic reference disambiguated by 
``object_type``;
+    # the same value can point at a dashboard, chart or saved query. It must 
not
+    # carry a foreign key to any single table: declaring FKs to dashboards,
+    # slices and saved_query at once is unsatisfiable (a row would have to 
exist
+    # in all three) and breaks tagging, e.g. tagging a dashboard fails the
+    # slices FK. The original migration (c82ee8a39623) defined no FK here. See
+    # issue #35941.
+    object_id = Column(Integer)

Review Comment:
   This is a deliberate scope call, covered in the PR body — the canonical 
migration chain (`c82ee8a39623` onward) never created these FKs, so only 
`create_all`-bootstrapped schemas carry them. A `downgrade` could never safely 
recreate an unsatisfiable constraint, so any migration would be a one-way 
introspected drop. I've got that exact tradeoff open with @aminghadersohi to 
decide whether it belongs here or in `UPDATING.md`.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to