fix data base
This commit is contained in:
21
bd/tables/poll.py
Normal file
21
bd/tables/poll.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from sqlalchemy import Column, String, Boolean, DateTime, Text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from .simple_base import Base
|
||||
import uuid
|
||||
|
||||
|
||||
class Poll(Base):
|
||||
__tablename__ = "polls"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
title = Column(String(255), nullable=False)
|
||||
description = Column(Text, nullable=True)
|
||||
is_active = Column(Boolean, default=True, nullable=False)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
|
||||
questions = relationship("Question", backref="poll", cascade="all, delete-orphan", passive_deletes=True)
|
||||
|
||||
|
||||
__all__ = ["Base", "Poll"]
|
||||
Reference in New Issue
Block a user