15 lines
477 B
Python
15 lines
477 B
Python
from sqlalchemy import Column, String, Integer, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
from .base import BaseModel
|
|
|
|
class Register(BaseModel):
|
|
__tablename__ = "registers"
|
|
|
|
address = Column(Integer)
|
|
function_code = Column(String)
|
|
name = Column(String)
|
|
description = Column(String, nullable=True)
|
|
device_id = Column(Integer, ForeignKey("devices.id"))
|
|
|
|
# 关系
|
|
device = relationship("Device", back_populates="registers") |