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 .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.12.0
DATABASE_SCHEMA: 5.0.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
-------------------

12.0.0 (2026-04-21)
-------------------

* Update database schema to v5.0.0 (breaking change, see https://github.com/DiamondLightSource/ispyb-database/blob/main/HISTORY.rst)

11.1.2 (2026-02-13)
-------------------

Expand Down
57 changes: 53 additions & 4 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.12.0"
__schema_version__ = "5.0.0"
import datetime
import decimal
from typing import List, Optional
Expand Down Expand Up @@ -2585,6 +2585,9 @@ class Component(Base):
"ComponentType", back_populates="Component"
)
Proposal: Mapped["Proposal"] = relationship("Proposal", back_populates="Component")
Protein_has_Component: Mapped[List["ProteinHasComponent"]] = relationship(
"ProteinHasComponent", back_populates="Component"
)
CrystalComposition: Mapped[List["CrystalComposition"]] = relationship(
"CrystalComposition", back_populates="Component"
)
Expand Down Expand Up @@ -2949,7 +2952,7 @@ class Ligand(Base):
proposalId: Mapped[int] = mapped_column(
INTEGER(10), comment="References Proposal table"
)
name: Mapped[str] = mapped_column(String(30), comment="Ligand name")
name: Mapped[str] = mapped_column(String(255))
SMILES: Mapped[Optional[str]] = mapped_column(
String(400), comment="Chemical structure"
)
Expand Down Expand Up @@ -3230,6 +3233,9 @@ class Protein(Base):
"ComponentLattice", back_populates="Protein"
)
Crystal: Mapped[List["Crystal"]] = relationship("Crystal", back_populates="Protein")
Protein_has_Component: Mapped[List["ProteinHasComponent"]] = relationship(
"ProteinHasComponent", back_populates="Protein"
)
Protein_has_PDB: Mapped[List["ProteinHasPDB"]] = relationship(
"ProteinHasPDB", back_populates="Protein"
)
Expand Down Expand Up @@ -3726,6 +3732,44 @@ class ExperimentKindDetails(Base):
)


class ProteinHasComponent(Base):
__tablename__ = "Protein_has_Component"
__table_args__ = (
ForeignKeyConstraint(
["componentId"],
["Component.componentId"],
ondelete="CASCADE",
onupdate="CASCADE",
name="Protein_has_Component_fk_componentId",
),
ForeignKeyConstraint(
["proteinId"],
["Protein.proteinId"],
ondelete="CASCADE",
onupdate="CASCADE",
name="Protein_has_Component_fk_proteinId",
),
Index("Protein_has_Component_fk_componentId", "componentId"),
Index("Protein_has_Component_fk_proteinId", "proteinId"),
{"comment": "Which elements are contained inside a molecule"},
)

proteinHasComponentId: Mapped[int] = mapped_column(INTEGER(11), primary_key=True)
proteinId: Mapped[int] = mapped_column(
INTEGER(10), comment="References Protein table"
)
componentId: Mapped[int] = mapped_column(
INTEGER(10), comment="References Component table"
)

Component: Mapped["Component"] = relationship(
"Component", back_populates="Protein_has_Component"
)
Protein: Mapped["Protein"] = relationship(
"Protein", back_populates="Protein_has_Component"
)


class ProteinHasPDB(Base):
__tablename__ = "Protein_has_PDB"
__table_args__ = (
Expand Down Expand Up @@ -5771,6 +5815,7 @@ class LaserParameters(Base):
name="LaserParameters_fk_robotActionId",
),
Index("LaserParameters_fk_robotActionId", "robotActionId"),
Index("LaserParameters_robotActionId_uc1", "robotActionId", unique=True),
{"comment": "Laser parameters"},
)

Expand Down Expand Up @@ -6429,6 +6474,12 @@ class LaserPoint(Base):
name="LaserPoint_fk_laserParametersId",
),
Index("LaserPoint_fk_laserParametersId", "laserParametersId"),
Index(
"LaserPoint_laserParametersId_pointIndex_uc1",
"laserParametersId",
"pointIndex",
unique=True,
),
{"comment": "Laser points"},
)

Expand Down Expand Up @@ -6874,8 +6925,6 @@ class GridInfo(Base):
Enum("vertical", "horizontal"), server_default=text("'horizontal'")
)
dataCollectionGroupId: Mapped[Optional[int]] = mapped_column(INTEGER(11))
pixelsPerMicronX: Mapped[Optional[float]] = mapped_column(Float)
pixelsPerMicronY: Mapped[Optional[float]] = mapped_column(Float)
snapshot_offsetXPixel: Mapped[Optional[float]] = mapped_column(Float)
snapshot_offsetYPixel: Mapped[Optional[float]] = mapped_column(Float)
snaked: Mapped[Optional[int]] = mapped_column(
Expand Down