Skip to content

Commit ae7349d

Browse files
gfrngithub-actions[bot]DiamondLightSource-build-server
authored
Bump schema version from v4.7.0 to v4.8.0 (#238)
* Bump schema version from v4.7.0 to v4.8.0 * Update ISPyB ORM schema to database schema v4.8.0 (#239) Generated with sqlacodegen 3.0.0rc5 SQLAlchemy 2.0.41 Co-authored-by: ISPyB-API Azure build <DiamondLightSource-build-server@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: ISPyB-API Azure build <DiamondLightSource-build-server@users.noreply.github.com>
1 parent 390d06b commit ae7349d

File tree

3 files changed

+120
-3
lines changed

3 files changed

+120
-3
lines changed

.github/workflows/test-and-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55

66
env:
7-
DATABASE_SCHEMA: 4.7.0
7+
DATABASE_SCHEMA: 4.8.0
88

99
permissions:
1010
contents: read

HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ History
55
Unreleased / main
66
-------------------
77

8+
11.0.4 (2025-07-17)
9+
-------------------
10+
11+
* Update database schema to v4.8.0
12+
813
11.0.3 (2025-05-12)
914
-------------------
1015

src/ispyb/sqlalchemy/_auto_db_schema.py

Lines changed: 114 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__schema_version__ = "4.7.0"
1+
__schema_version__ = "4.8.0"
22
import datetime
33
import decimal
44
from typing import List, Optional
@@ -776,6 +776,9 @@ class PDB(Base):
776776
String(30), comment="Could be e.g. AlphaFold or RoseTTAFold"
777777
)
778778

779+
Ligand: Mapped[List["Ligand"]] = relationship(
780+
"Ligand", secondary="Ligand_has_PDB", back_populates="PDB"
781+
)
779782
Protein_has_PDB: Mapped[List["ProteinHasPDB"]] = relationship(
780783
"ProteinHasPDB", back_populates="PDB"
781784
)
@@ -2252,6 +2255,7 @@ class Proposal(Base):
22522255
LabContact: Mapped[List["LabContact"]] = relationship(
22532256
"LabContact", back_populates="Proposal"
22542257
)
2258+
Ligand: Mapped[List["Ligand"]] = relationship("Ligand", back_populates="Proposal")
22552259
ProposalHasPerson: Mapped[List["ProposalHasPerson"]] = relationship(
22562260
"ProposalHasPerson", back_populates="Proposal"
22572261
)
@@ -2492,6 +2496,9 @@ class BLSession(Base):
24922496
server_default=text("0"),
24932497
comment="Flag to indicate whether the processed folder in the associated visit directory has been purged",
24942498
)
2499+
icatId: Mapped[Optional[int]] = mapped_column(
2500+
INTEGER(11), comment="The internal ICAT ID for this BLSession"
2501+
)
24952502

24962503
Project: Mapped[List["Project"]] = relationship(
24972504
"Project", secondary="Project_has_Session", back_populates="BLSession"
@@ -2918,6 +2925,51 @@ class LabContact(Base):
29182925
)
29192926

29202927

2928+
class Ligand(Base):
2929+
__tablename__ = "Ligand"
2930+
__table_args__ = (
2931+
ForeignKeyConstraint(
2932+
["proposalId"],
2933+
["Proposal.proposalId"],
2934+
ondelete="CASCADE",
2935+
onupdate="CASCADE",
2936+
name="Ligand_fk_proposalId",
2937+
),
2938+
Index("Ligand_fk_proposalId", "proposalId"),
2939+
{"comment": "Ligands in biochemistry are substances that bind to biomolecules"},
2940+
)
2941+
2942+
ligandId: Mapped[int] = mapped_column(INTEGER(11), primary_key=True)
2943+
proposalId: Mapped[int] = mapped_column(
2944+
INTEGER(10), comment="References Proposal table"
2945+
)
2946+
name: Mapped[str] = mapped_column(String(30), comment="Ligand name")
2947+
SMILES: Mapped[Optional[str]] = mapped_column(
2948+
String(400), comment="Chemical structure"
2949+
)
2950+
libraryName: Mapped[Optional[str]] = mapped_column(
2951+
String(30), comment="Name of ligand library, to preserve provenance"
2952+
)
2953+
libraryBatchNumber: Mapped[Optional[str]] = mapped_column(
2954+
String(30), comment="Batch number of library, to preserve provenance"
2955+
)
2956+
plateBarcode: Mapped[Optional[str]] = mapped_column(
2957+
String(30),
2958+
comment="Specific barcode of the plate it came from, to preserve provenance",
2959+
)
2960+
sourceWell: Mapped[Optional[str]] = mapped_column(
2961+
String(30), comment="Location within that plate, to preserve provenance"
2962+
)
2963+
2964+
Proposal: Mapped["Proposal"] = relationship("Proposal", back_populates="Ligand")
2965+
PDB: Mapped[List["PDB"]] = relationship(
2966+
"PDB", secondary="Ligand_has_PDB", back_populates="Ligand"
2967+
)
2968+
BLSample: Mapped[List["BLSample"]] = relationship(
2969+
"BLSample", secondary="BLSample_has_Ligand", back_populates="Ligand"
2970+
)
2971+
2972+
29212973
class PhasingStatistics(Base):
29222974
__tablename__ = "PhasingStatistics"
29232975
__table_args__ = (
@@ -3549,6 +3601,9 @@ class DewarRegistry(Base):
35493601
bltimestamp: Mapped[datetime.datetime] = mapped_column(
35503602
DateTime, server_default=text("current_timestamp()")
35513603
)
3604+
type: Mapped[str] = mapped_column(
3605+
Enum("Dewar", "Toolbox", "Thermal Shipper"), server_default=text("'Dewar'")
3606+
)
35523607
proposalId: Mapped[Optional[int]] = mapped_column(INTEGER(11))
35533608
labContactId: Mapped[Optional[int]] = mapped_column(INTEGER(11))
35543609
purchaseDate: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime)
@@ -3597,6 +3652,30 @@ class ExperimentKindDetails(Base):
35973652
)
35983653

35993654

3655+
t_Ligand_has_PDB = Table(
3656+
"Ligand_has_PDB",
3657+
Base.metadata,
3658+
Column("ligandId", INTEGER(11), primary_key=True, nullable=False),
3659+
Column("pdbId", INTEGER(11), primary_key=True, nullable=False),
3660+
ForeignKeyConstraint(
3661+
["ligandId"],
3662+
["Ligand.ligandId"],
3663+
ondelete="CASCADE",
3664+
onupdate="CASCADE",
3665+
name="Ligand_Has_PDB_fk1",
3666+
),
3667+
ForeignKeyConstraint(
3668+
["pdbId"],
3669+
["PDB.pdbId"],
3670+
ondelete="CASCADE",
3671+
onupdate="CASCADE",
3672+
name="Ligand_Has_PDB_fk2",
3673+
),
3674+
Index("Ligand_Has_PDB_fk2", "pdbId"),
3675+
comment="Junction table for Ligand and PDB",
3676+
)
3677+
3678+
36003679
t_Project_has_Protein = Table(
36013680
"Project_has_Protein",
36023681
Base.metadata,
@@ -4671,6 +4750,9 @@ class BLSample(Base):
46714750
ScreenComponentGroup: Mapped["ScreenComponentGroup"] = relationship(
46724751
"ScreenComponentGroup", back_populates="BLSample"
46734752
)
4753+
Ligand: Mapped[List["Ligand"]] = relationship(
4754+
"Ligand", secondary="BLSample_has_Ligand", back_populates="BLSample"
4755+
)
46744756
Project: Mapped[List["Project"]] = relationship(
46754757
"Project", secondary="Project_has_BLSample", back_populates="BLSample"
46764758
)
@@ -4992,7 +5074,7 @@ class BLSamplePosition(Base):
49925074
posY: Mapped[Optional[decimal.Decimal]] = mapped_column(Double(asdecimal=True))
49935075
posZ: Mapped[Optional[decimal.Decimal]] = mapped_column(Double(asdecimal=True))
49945076
recordTimeStamp: Mapped[Optional[datetime.datetime]] = mapped_column(
4995-
DateTime, comment="Creation or last update date/time"
5077+
DateTime, server_default=text("current_timestamp()")
49965078
)
49975079
positionType: Mapped[Optional[str]] = mapped_column(
49985080
Enum("dispensing"),
@@ -5032,6 +5114,30 @@ class BLSampleHasDataCollectionPlan(Base):
50325114
)
50335115

50345116

5117+
t_BLSample_has_Ligand = Table(
5118+
"BLSample_has_Ligand",
5119+
Base.metadata,
5120+
Column("blSampleId", INTEGER(10), primary_key=True, nullable=False),
5121+
Column("ligandId", INTEGER(11), primary_key=True, nullable=False),
5122+
ForeignKeyConstraint(
5123+
["blSampleId"],
5124+
["BLSample.blSampleId"],
5125+
ondelete="CASCADE",
5126+
onupdate="CASCADE",
5127+
name="BLSample_has_Ligand_fk1",
5128+
),
5129+
ForeignKeyConstraint(
5130+
["ligandId"],
5131+
["Ligand.ligandId"],
5132+
ondelete="CASCADE",
5133+
onupdate="CASCADE",
5134+
name="BLSample_has_Ligand_fk2",
5135+
),
5136+
Index("BLSample_has_Ligand_fk2", "ligandId"),
5137+
comment="Junction table for BLSample and Ligand",
5138+
)
5139+
5140+
50355141
class BLSampleHasPositioner(Base):
50365142
__tablename__ = "BLSample_has_Positioner"
50375143
__table_args__ = (
@@ -7584,6 +7690,12 @@ class Tomogram(Base):
75847690
gridSquareId: Mapped[Optional[int]] = mapped_column(
75857691
INTEGER(11), comment="FK, references medium mag map in GridSquare"
75867692
)
7693+
pixelLocationX: Mapped[Optional[int]] = mapped_column(
7694+
INTEGER(11), comment="pixel location of tomogram centre on search map image (x)"
7695+
)
7696+
pixelLocationY: Mapped[Optional[int]] = mapped_column(
7697+
INTEGER(11), comment="pixel location of tomogram centre on search map image (y)"
7698+
)
75877699

75887700
AutoProcProgram: Mapped["AutoProcProgram"] = relationship(
75897701
"AutoProcProgram", back_populates="Tomogram"

0 commit comments

Comments
 (0)