fix: Remove unique name restriction on agents (#592)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""Remove unique name restriction on agents
|
||||
|
||||
Revision ID: cdb3db091113
|
||||
Revises: e20573fe9b86
|
||||
Create Date: 2025-01-10 15:36:08.728539
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "cdb3db091113"
|
||||
down_revision: Union[str, None] = "e20573fe9b86"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint("unique_org_agent_name", "agents", type_="unique")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_unique_constraint("unique_org_agent_name", "agents", ["organization_id", "name"])
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,7 +1,7 @@
|
||||
import uuid
|
||||
from typing import TYPE_CHECKING, List, Optional
|
||||
|
||||
from sqlalchemy import JSON, String, UniqueConstraint
|
||||
from sqlalchemy import JSON, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from letta.orm.block import Block
|
||||
@@ -27,7 +27,6 @@ if TYPE_CHECKING:
|
||||
class Agent(SqlalchemyBase, OrganizationMixin):
|
||||
__tablename__ = "agents"
|
||||
__pydantic_model__ = PydanticAgentState
|
||||
__table_args__ = (UniqueConstraint("organization_id", "name", name="unique_org_agent_name"),)
|
||||
|
||||
# agent generates its own id
|
||||
# TODO: We want to migrate all the ORM models to do this, so we will need to move this to the SqlalchemyBase
|
||||
|
||||
Reference in New Issue
Block a user