diff --git a/src/phoenix/db/migrations/versions/bc8fea3c2bc8_add_prompt_tables.py b/src/phoenix/db/migrations/versions/bc8fea3c2bc8_add_prompt_tables.py index d3012e70de..c0ff171099 100644 --- a/src/phoenix/db/migrations/versions/bc8fea3c2bc8_add_prompt_tables.py +++ b/src/phoenix/db/migrations/versions/bc8fea3c2bc8_add_prompt_tables.py @@ -149,7 +149,7 @@ def upgrade() -> None: ) op.create_table( - "prompt_tags", + "prompt_version_tags", sa.Column("id", sa.Integer, primary_key=True), sa.Column("name", sa.String, nullable=False), sa.Column("description", sa.String, nullable=True), @@ -182,7 +182,7 @@ def upgrade() -> None: def downgrade() -> None: - op.drop_table("prompt_tags") + op.drop_table("prompt_version_tags") op.drop_table("prompt_versions") op.drop_table("prompts_prompt_labels") op.drop_table("prompts") diff --git a/src/phoenix/db/models.py b/src/phoenix/db/models.py index af1190215c..50f15425bd 100644 --- a/src/phoenix/db/models.py +++ b/src/phoenix/db/models.py @@ -841,8 +841,8 @@ class Prompt(Base): uselist=True, ) - prompt_tags: Mapped[list["PromptTag"]] = relationship( - "PromptTag", + prompt_version_tags: Mapped[list["PromptVersionTag"]] = relationship( + "PromptVersionTag", back_populates="prompt", cascade="all, delete-orphan", uselist=True, @@ -911,16 +911,16 @@ class PromptVersion(Base): prompt: Mapped["Prompt"] = relationship("Prompt", back_populates="prompt_versions") - prompt_tags: Mapped[list["PromptTag"]] = relationship( - "PromptTag", + prompt_version_tags: Mapped[list["PromptVersionTag"]] = relationship( + "PromptVersionTag", back_populates="prompt_version", cascade="all, delete-orphan", uselist=True, ) -class PromptTag(Base): - __tablename__ = "prompt_tags" +class PromptVersionTag(Base): + __tablename__ = "prompt_version_tags" id: Mapped[int] = mapped_column(primary_key=True) name: Mapped[str] = mapped_column(String, nullable=False) @@ -941,9 +941,9 @@ class PromptTag(Base): nullable=True, ) - prompt: Mapped["Prompt"] = relationship("Prompt", back_populates="prompt_tags") + prompt: Mapped["Prompt"] = relationship("Prompt", back_populates="prompt_version_tags") prompt_version: Mapped["PromptVersion"] = relationship( - "PromptVersion", back_populates="prompt_tags" + "PromptVersion", back_populates="prompt_version_tags" ) __table_args__ = (UniqueConstraint("name", "prompt_id"),)