File size: 461 Bytes
b7a7f32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship

from core.db import Base


class Department(Base):
    id = Column(Integer, primary_key=True)
    name = Column(String(length=128))
    school_id = Column(
        Integer,
        ForeignKey("school.id", ondelete="CASCADE"), nullable=True,
    )
    school = relationship("School", backref="departments", passive_deletes=True)
    __tablename__ = "department"