Skip to content
Closed
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
2 changes: 1 addition & 1 deletion server/app/db/dbconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# Create an asynchronous engine with connection pooling
engine = create_async_engine(
DATABASE_URL,
echo=True, # For debugging, log SQL statements
echo=False, # For debugging, log SQL statements
)

# Create a session maker
Expand Down
18 changes: 18 additions & 0 deletions server/app/db/dbmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
MetaData,
SmallInteger
)
from sqlalchemy.dialects.postgresql import TSVECTOR

metadata = MetaData()

Expand Down Expand Up @@ -198,4 +199,21 @@
# indexes for registered_servers
Index("idx_registered_servers_host_info", "host_info"),
Index("idx_registered_servers_server_name", "server_name")
)

label_content = Table(
"label_content", metadata,
Column("id", Integer, primary_key=True, autoincrement=True, nullable=False),
Column("artifact_id", Integer, nullable=False),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this artifact_id of the dataset associated with the label ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is the id of this label in the artifact table.

Column("file_name", String(255), nullable=False),
Column("full_text_content", Text, nullable=False),
Column("content_tsvector", TSVECTOR, nullable=True),
Column("created_at", BigInteger, nullable=False),

# Indexes
Index("idx_label_content_artifact_id", "artifact_id"),
Index("idx_label_content_tsvector", "content_tsvector", postgresql_using="gin"),

# Unique Constraint - composite key to allow multiple labels per artifact
UniqueConstraint("artifact_id", "file_name", name="label_content_artifact_file_key")
)
Loading