Dispensing Vet

This commit is contained in:
2026-04-26 16:02:42 -04:00
parent 9ec27e245a
commit 05a093afd3
6 changed files with 64 additions and 7 deletions
+4
View File
@@ -230,6 +230,10 @@ def migrate_compliance_schema() -> None:
)
print("Backfilled dispensing mode where missing")
if _table_exists(cursor, "dispensings") and not _column_exists(cursor, "dispensings", "prescribing_vet"):
cursor.execute("ALTER TABLE dispensings ADD COLUMN prescribing_vet VARCHAR")
print("Added dispensings.prescribing_vet")
# Seed default locations once table exists (created via SQLAlchemy create_all).
if _table_exists(cursor, "locations"):
cursor.execute("INSERT OR IGNORE INTO locations(name, is_active) VALUES ('Cupboard', 1)")
+1
View File
@@ -60,6 +60,7 @@ class Dispensing(Base):
requested_pack_id = Column(Integer, ForeignKey("variant_packs.id"), nullable=True)
requested_pack_count = Column(Float, nullable=True)
animal_name = Column(String, nullable=True) # Name/ID of the animal (optional)
prescribing_vet = Column(String, nullable=True) # Prescribing vet's name (required for controlled drugs)
user_name = Column(String, nullable=False) # User who dispensed
dispensed_at = Column(DateTime(timezone=True), server_default=func.now(), index=True)
notes = Column(String, nullable=True)