37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from sqlalchemy import Column, Integer, String, TIMESTAMP, ForeignKey
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from sqlalchemy.orm import relationship
|
|
|
|
Base = declarative_base()
|
|
|
|
class Account(Base):
|
|
__tablename__ = 'accounts'
|
|
id = Column(Integer, primary_key=True)
|
|
user_id = Column(String)
|
|
password = Column(String)
|
|
|
|
active_sessions = relationship("ActiveSession", back_populates="account")
|
|
|
|
class ActiveSession(Base):
|
|
__tablename__ = 'active_sessions'
|
|
id = Column(Integer, primary_key=True)
|
|
session_id = Column(String)
|
|
last_active = Column(TIMESTAMP)
|
|
user_id = Column(Integer, ForeignKey('accounts.id'))
|
|
account = relationship("Account", back_populates="active_sessions")
|
|
|
|
class ChannelId(Base):
|
|
__tablename__ = 'channel_ids'
|
|
id = Column(Integer, primary_key=True)
|
|
channel_id = Column(String)
|
|
|
|
class QuizMaster(Base):
|
|
__tablename__ = 'quiz_master'
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
title = Column(String)
|
|
full_audio_name = Column(String)
|
|
intro_audio_name = Column(String)
|
|
keyword1 = Column(String)
|
|
keyword2 = Column(String)
|
|
keyword3 = Column(String)
|