Skip to content

Commit f8c3be6

Browse files
authored
Create atleta.py
1 parent 5d6c849 commit f8c3be6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

app/models/atleta.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from sqlalchemy import Column, Integer, String, ForeignKey
2+
from sqlalchemy.orm import relationship
3+
from app.db.base import Base
4+
5+
class Atleta(Base):
6+
__tablename__ = "atletas"
7+
8+
id = Column(Integer, primary_key=True, index=True)
9+
nome = Column(String(255), nullable=False)
10+
cpf = Column(String(20), nullable=False, unique=True, index=True)
11+
categoria_id = Column(Integer, ForeignKey("categorias.id", ondelete="SET NULL"), nullable=True)
12+
centro_id = Column(Integer, ForeignKey("centros.id", ondelete="SET NULL"), nullable=True)
13+
14+
categoria = relationship("Categoria", back_populates="atletas")
15+
centro = relationship("CentroTreinamento", back_populates="atletas")

0 commit comments

Comments
 (0)