Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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: 7 additions & 2 deletions backend/database/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ class ToolInstance(TableBase):
__table_args__ = {"schema": SCHEMA}

tool_instance_id = Column(
Integer, primary_key=True, nullable=False, doc="ID")
Integer,
Sequence("ag_tool_instance_t_tool_instance_id_seq", schema=SCHEMA),
primary_key=True,
nullable=False,
doc="ID"
)
tool_id = Column(Integer, doc="Tenant tool ID")
agent_id = Column(Integer, doc="Agent ID")
params = Column(JSON, doc="Parameter configuration")
Expand Down Expand Up @@ -351,7 +356,7 @@ class AgentRelation(TableBase):
__tablename__ = "ag_agent_relation_t"
__table_args__ = {"schema": SCHEMA}

relation_id = Column(Integer, primary_key=True, autoincrement=True, nullable=False, doc="Relationship ID, primary key")
relation_id = Column(Integer, Sequence("ag_agent_relation_t_relation_id_seq", schema=SCHEMA), primary_key=True, nullable=False, doc="Relationship ID, primary key")
selected_agent_id = Column(Integer, primary_key=True, doc="Selected agent ID")
parent_agent_id = Column(Integer, doc="Parent agent ID")
tenant_id = Column(String(100), doc="Tenant ID")
Expand Down
4 changes: 2 additions & 2 deletions docker/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ WHERE delete_flag = 'N';

-- Create the ag_tool_instance_t table in the nexent schema
CREATE TABLE IF NOT EXISTS nexent.ag_tool_instance_t (
tool_instance_id INTEGER NOT NULL,
tool_instance_id SERIAL NOT NULL,
tool_id INTEGER,
agent_id INTEGER,
params JSON,
Expand Down Expand Up @@ -564,7 +564,7 @@ COMMENT ON COLUMN nexent.user_tenant_t.delete_flag IS 'Delete flag, Y/N';

-- Create the ag_agent_relation_t table in the nexent schema
CREATE TABLE IF NOT EXISTS nexent.ag_agent_relation_t (
relation_id INTEGER NOT NULL,
relation_id SERIAL NOT NULL,
selected_agent_id INTEGER,
parent_agent_id INTEGER,
tenant_id VARCHAR(100),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Step 1: Create sequence for auto-increment
CREATE SEQUENCE IF NOT EXISTS "nexent"."ag_tool_instance_t_tool_instance_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 2147483647
START 1
CACHE 1;

CREATE SEQUENCE IF NOT EXISTS "nexent"."ag_agent_relation_t_relation_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 2147483647
START 1
CACHE 1;
Loading