Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop all the foreign keys on artifacts table except for the organization_id #1352

Merged
merged 2 commits into from
Dec 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions skyvern/forge/sdk/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,15 @@ class ArtifactModel(Base):
__table_args__ = (
Index("org_task_step_index", "organization_id", "task_id", "step_id"),
Index("org_workflow_run_index", "organization_id", "workflow_run_id"),
Index("org_observer_cruise_index", "organization_id", "observer_cruise_id"),
)

artifact_id = Column(String, primary_key=True, index=True, default=generate_artifact_id)
organization_id = Column(String, ForeignKey("organizations.organization_id"))
workflow_run_id = Column(String, ForeignKey("workflow_runs.workflow_run_id"))
workflow_run_block_id = Column(String, ForeignKey("workflow_run_blocks.workflow_run_block_id"))
observer_cruise_id = Column(String, ForeignKey("observer_cruises.observer_cruise_id"))
observer_thought_id = Column(String, ForeignKey("observer_thoughts.observer_thought_id"))
workflow_run_id = Column(String)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing ForeignKey constraints for workflow_run_id, workflow_run_block_id, observer_cruise_id, and observer_thought_id in ArtifactModel can lead to data integrity issues. Consider keeping these constraints to ensure referential integrity.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing foreign key constraints from workflow_run_id, workflow_run_block_id, observer_cruise_id, and observer_thought_id may lead to data integrity issues. Consider keeping these constraints if these fields are meant to reference existing records.

workflow_run_block_id = Column(String)
observer_cruise_id = Column(String)
observer_thought_id = Column(String)
task_id = Column(String, ForeignKey("tasks.task_id"))
step_id = Column(String, ForeignKey("steps.step_id"), index=True)
artifact_type = Column(String)
Expand Down
Loading