首次提交by MimoCode
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, Boolean, ForeignKey, DateTime
|
||||
from sqlalchemy.orm import relationship
|
||||
from datetime import datetime
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class Batch(Base):
|
||||
__tablename__ = "batches"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
medicine_id = Column(Integer, ForeignKey("medicines.id"), nullable=False, index=True)
|
||||
batch_no = Column(String(100))
|
||||
production_date = Column(Date)
|
||||
expiry_date = Column(Date, nullable=False)
|
||||
quantity = Column(Integer, nullable=False, default=0)
|
||||
location = Column(String(200))
|
||||
is_expired = Column(Boolean, default=False)
|
||||
created_at = Column(DateTime, default=datetime.utcnow)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
medicine = relationship("Medicine", back_populates="batches")
|
||||
audit_logs = relationship("AuditLog", back_populates="batch")
|
||||
Reference in New Issue
Block a user