-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.py
25 lines (22 loc) · 856 Bytes
/
game.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from sqlalchemy import Column, DateTime, String, Integer, ForeignKey, Table, func
from sqlalchemy.orm import relationship, backref
from base import Base
class Game(Base):
__tablename__ = 'games'
id = Column(Integer, primary_key=True)
name = Column(String(255))
status = Column(Integer, default=1) # STATUS_PRIVATE
created_on = Column(DateTime, default=func.now())
user_id = Column(Integer, ForeignKey('users.id'))
user = relationship(
'User',
backref=backref('user',
# uselist=True,
cascade='delete,all'))
questions = relationship(
'Question',
backref=backref('question',
uselist=True,
# cascade='delete,all'
))
plays = relationship("Play", back_populates="game")