now creating dewars from spreadsheet

This commit is contained in:
GotthardG
2024-11-12 14:00:32 +01:00
parent 5e6eb40033
commit 86883133a7
14 changed files with 1284 additions and 1027 deletions

View File

@ -25,7 +25,7 @@ class Shipment(Base):
class ContactPerson(Base):
__tablename__ = "contact_persons"
id = Column(Integer, primary_key=True, index=True)
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
firstname = Column(String)
lastname = Column(String)
phone_number = Column(String)
@ -37,7 +37,7 @@ class ContactPerson(Base):
class Address(Base):
__tablename__ = "addresses"
id = Column(Integer, primary_key=True, index=True)
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
street = Column(String)
city = Column(String)
zipcode = Column(String)
@ -81,7 +81,7 @@ class Dewar(Base):
class Proposal(Base):
__tablename__ = "proposals"
id = Column(Integer, primary_key=True, index=True)
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
number = Column(String)
shipments = relationship("Shipment", back_populates="proposal")
@ -90,21 +90,21 @@ class Proposal(Base):
class Puck(Base):
__tablename__ = 'pucks'
id = Column(Integer, primary_key=True, index=True)
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
puck_name = Column(String, index=True)
puck_type = Column(String)
puck_location_in_dewar = Column(Integer)
# Foreign keys and relationships
dewar_id = Column(Integer, ForeignKey('dewars.id'))
dewar = relationship("Dewar", back_populates="pucks") # Properly define the other side of the relationship
dewar = relationship("Dewar", back_populates="pucks")
samples = relationship("Sample", back_populates="puck")
class Sample(Base):
__tablename__ = 'samples'
id = Column(Integer, primary_key=True, index=True)
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
sample_name = Column(String, index=True) # Matches `sample_name` in data creation
position = Column(Integer) # Matches `position` in data creation script