db_models.py 466 B

123456789101112131415161718
  1. from sqlalchemy import ForeignKey, Float
  2. from sqlalchemy import Column, Integer, String
  3. from sqlalchemy.ext.declarative import declarative_base
  4. BASE = declarative_base()
  5. class Task(BASE):
  6. __tablename__ = "task"
  7. id = Column(Integer, primary_key=True)
  8. parent_task_id = Column(Integer, ForeignKey('task.id'))
  9. name = Column(String)
  10. def __init__(self, parent_task_id, name):
  11. self.parent_task_id = parent_task_id
  12. self.name = name