17 lines
556 B
Python
17 lines
556 B
Python
|
import uuid
|
||
|
from sqlalchemy import Uuid, Column, DateTime, Enum, Float, ForeignKey, String
|
||
|
|
||
|
from app.database import Base
|
||
|
from app.schemas.meter_value import Measurand, PhaseType
|
||
|
|
||
|
class Transaction(Base):
|
||
|
__tablename__ = "meter_values"
|
||
|
|
||
|
id = Column(Uuid, primary_key=True, default=uuid.uuid4)
|
||
|
timestamp = Column(DateTime, index=True)
|
||
|
measurand = Column(Enum(Measurand))
|
||
|
phase_type = Column(Enum(PhaseType))
|
||
|
unit = Column(String)
|
||
|
value = Column(Float)
|
||
|
|
||
|
transaction_id = Column(Uuid, ForeignKey("transactions.id"), index=True)
|