17 lines
509 B
Python
17 lines
509 B
Python
from sqlalchemy import Column, String, Integer, ForeignKey
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from .simple_base import Base
|
|
import uuid
|
|
|
|
|
|
class Choice(Base):
|
|
__tablename__ = "choices"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
question_id = Column(UUID(as_uuid=True), ForeignKey("questions.id", ondelete="CASCADE"), nullable=False)
|
|
text = Column(String(500), nullable=False)
|
|
position = Column(Integer, nullable=True)
|
|
|
|
|
|
__all__ = ["Base", "Choice"]
|