| 25 | |
| 26 | |
| 27 | class Data(Base): |
| 28 | __tablename__ = 'data' |
| 29 | |
| 30 | id = Column(Integer, primary_key=True, index=True, autoincrement=True) |
| 31 | audio_id = Column(Integer, ForeignKey('audio.id'), comment='音频文件') # ForeignKey里的字符串格式不是类名.属性名,而是表名.字段名 |
| 32 | audio = relationship('Audio', back_populates='data') # 'Audio'是关联的类名;back_populates来指定反向访问的属性名称 |
| 33 | |
| 34 | segment_title = Column(String(200), comment='segment后的音频名称') |
| 35 | segment_content = Column(Text, comment='segment后的音频内容') |
| 36 | complete = Column(Boolean, default=False, comment='segment状态') |
| 37 | |
| 38 | def __repr__(self): |
| 39 | return f'{repr(self.audio_title)}' |
nothing calls this directly
no outgoing calls
no test coverage detected