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
2 changes: 1 addition & 1 deletion .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:

env:
DATABASE_SCHEMA: 4.7.0
DATABASE_SCHEMA: 4.8.0

permissions:
contents: read
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ History
Unreleased / main
-------------------

11.0.4 (2025-07-17)
-------------------

* Update database schema to v4.8.0

11.0.3 (2025-05-12)
-------------------

Expand Down
116 changes: 114 additions & 2 deletions src/ispyb/sqlalchemy/_auto_db_schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__schema_version__ = "4.7.0"
__schema_version__ = "4.8.0"
import datetime
import decimal
from typing import List, Optional
Expand Down Expand Up @@ -776,6 +776,9 @@ class PDB(Base):
String(30), comment="Could be e.g. AlphaFold or RoseTTAFold"
)

Ligand: Mapped[List["Ligand"]] = relationship(
"Ligand", secondary="Ligand_has_PDB", back_populates="PDB"
)
Protein_has_PDB: Mapped[List["ProteinHasPDB"]] = relationship(
"ProteinHasPDB", back_populates="PDB"
)
Expand Down Expand Up @@ -2252,6 +2255,7 @@ class Proposal(Base):
LabContact: Mapped[List["LabContact"]] = relationship(
"LabContact", back_populates="Proposal"
)
Ligand: Mapped[List["Ligand"]] = relationship("Ligand", back_populates="Proposal")
ProposalHasPerson: Mapped[List["ProposalHasPerson"]] = relationship(
"ProposalHasPerson", back_populates="Proposal"
)
Expand Down Expand Up @@ -2492,6 +2496,9 @@ class BLSession(Base):
server_default=text("0"),
comment="Flag to indicate whether the processed folder in the associated visit directory has been purged",
)
icatId: Mapped[Optional[int]] = mapped_column(
INTEGER(11), comment="The internal ICAT ID for this BLSession"
)

Project: Mapped[List["Project"]] = relationship(
"Project", secondary="Project_has_Session", back_populates="BLSession"
Expand Down Expand Up @@ -2918,6 +2925,51 @@ class LabContact(Base):
)


class Ligand(Base):
__tablename__ = "Ligand"
__table_args__ = (
ForeignKeyConstraint(
["proposalId"],
["Proposal.proposalId"],
ondelete="CASCADE",
onupdate="CASCADE",
name="Ligand_fk_proposalId",
),
Index("Ligand_fk_proposalId", "proposalId"),
{"comment": "Ligands in biochemistry are substances that bind to biomolecules"},
)

ligandId: Mapped[int] = mapped_column(INTEGER(11), primary_key=True)
proposalId: Mapped[int] = mapped_column(
INTEGER(10), comment="References Proposal table"
)
name: Mapped[str] = mapped_column(String(30), comment="Ligand name")
SMILES: Mapped[Optional[str]] = mapped_column(
String(400), comment="Chemical structure"
)
libraryName: Mapped[Optional[str]] = mapped_column(
String(30), comment="Name of ligand library, to preserve provenance"
)
libraryBatchNumber: Mapped[Optional[str]] = mapped_column(
String(30), comment="Batch number of library, to preserve provenance"
)
plateBarcode: Mapped[Optional[str]] = mapped_column(
String(30),
comment="Specific barcode of the plate it came from, to preserve provenance",
)
sourceWell: Mapped[Optional[str]] = mapped_column(
String(30), comment="Location within that plate, to preserve provenance"
)

Proposal: Mapped["Proposal"] = relationship("Proposal", back_populates="Ligand")
PDB: Mapped[List["PDB"]] = relationship(
"PDB", secondary="Ligand_has_PDB", back_populates="Ligand"
)
BLSample: Mapped[List["BLSample"]] = relationship(
"BLSample", secondary="BLSample_has_Ligand", back_populates="Ligand"
)


class PhasingStatistics(Base):
__tablename__ = "PhasingStatistics"
__table_args__ = (
Expand Down Expand Up @@ -3549,6 +3601,9 @@ class DewarRegistry(Base):
bltimestamp: Mapped[datetime.datetime] = mapped_column(
DateTime, server_default=text("current_timestamp()")
)
type: Mapped[str] = mapped_column(
Enum("Dewar", "Toolbox", "Thermal Shipper"), server_default=text("'Dewar'")
)
proposalId: Mapped[Optional[int]] = mapped_column(INTEGER(11))
labContactId: Mapped[Optional[int]] = mapped_column(INTEGER(11))
purchaseDate: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime)
Expand Down Expand Up @@ -3597,6 +3652,30 @@ class ExperimentKindDetails(Base):
)


t_Ligand_has_PDB = Table(
"Ligand_has_PDB",
Base.metadata,
Column("ligandId", INTEGER(11), primary_key=True, nullable=False),
Column("pdbId", INTEGER(11), primary_key=True, nullable=False),
ForeignKeyConstraint(
["ligandId"],
["Ligand.ligandId"],
ondelete="CASCADE",
onupdate="CASCADE",
name="Ligand_Has_PDB_fk1",
),
ForeignKeyConstraint(
["pdbId"],
["PDB.pdbId"],
ondelete="CASCADE",
onupdate="CASCADE",
name="Ligand_Has_PDB_fk2",
),
Index("Ligand_Has_PDB_fk2", "pdbId"),
comment="Junction table for Ligand and PDB",
)


t_Project_has_Protein = Table(
"Project_has_Protein",
Base.metadata,
Expand Down Expand Up @@ -4671,6 +4750,9 @@ class BLSample(Base):
ScreenComponentGroup: Mapped["ScreenComponentGroup"] = relationship(
"ScreenComponentGroup", back_populates="BLSample"
)
Ligand: Mapped[List["Ligand"]] = relationship(
"Ligand", secondary="BLSample_has_Ligand", back_populates="BLSample"
)
Project: Mapped[List["Project"]] = relationship(
"Project", secondary="Project_has_BLSample", back_populates="BLSample"
)
Expand Down Expand Up @@ -4992,7 +5074,7 @@ class BLSamplePosition(Base):
posY: Mapped[Optional[decimal.Decimal]] = mapped_column(Double(asdecimal=True))
posZ: Mapped[Optional[decimal.Decimal]] = mapped_column(Double(asdecimal=True))
recordTimeStamp: Mapped[Optional[datetime.datetime]] = mapped_column(
DateTime, comment="Creation or last update date/time"
DateTime, server_default=text("current_timestamp()")
)
positionType: Mapped[Optional[str]] = mapped_column(
Enum("dispensing"),
Expand Down Expand Up @@ -5032,6 +5114,30 @@ class BLSampleHasDataCollectionPlan(Base):
)


t_BLSample_has_Ligand = Table(
"BLSample_has_Ligand",
Base.metadata,
Column("blSampleId", INTEGER(10), primary_key=True, nullable=False),
Column("ligandId", INTEGER(11), primary_key=True, nullable=False),
ForeignKeyConstraint(
["blSampleId"],
["BLSample.blSampleId"],
ondelete="CASCADE",
onupdate="CASCADE",
name="BLSample_has_Ligand_fk1",
),
ForeignKeyConstraint(
["ligandId"],
["Ligand.ligandId"],
ondelete="CASCADE",
onupdate="CASCADE",
name="BLSample_has_Ligand_fk2",
),
Index("BLSample_has_Ligand_fk2", "ligandId"),
comment="Junction table for BLSample and Ligand",
)


class BLSampleHasPositioner(Base):
__tablename__ = "BLSample_has_Positioner"
__table_args__ = (
Expand Down Expand Up @@ -7584,6 +7690,12 @@ class Tomogram(Base):
gridSquareId: Mapped[Optional[int]] = mapped_column(
INTEGER(11), comment="FK, references medium mag map in GridSquare"
)
pixelLocationX: Mapped[Optional[int]] = mapped_column(
INTEGER(11), comment="pixel location of tomogram centre on search map image (x)"
)
pixelLocationY: Mapped[Optional[int]] = mapped_column(
INTEGER(11), comment="pixel location of tomogram centre on search map image (y)"
)

AutoProcProgram: Mapped["AutoProcProgram"] = relationship(
"AutoProcProgram", back_populates="Tomogram"
Expand Down