Пример #1
0
def twitch_alert_db_manager_tables(twitch_alert_db_manager):
    with session_manager() as session:
        session.execute(delete(TwitchAlerts))
        session.execute(delete(TeamInTwitchAlert))
        session.execute(delete(UserInTwitchAlert))
        session.execute(delete(UserInTwitchTeam))
        session.commit()

        setup()
        return twitch_alert_db_manager
Пример #2
0
def test_create_tables():
    setup()
    tables = [
        'TwitchAlerts', 'UserInTwitchAlert', 'TeamInTwitchAlert',
        'UserInTwitchTeam'
    ]
    sql_check_table_exists = "SELECT name FROM sqlite_master " \
                             "WHERE type='table' AND " \
                             "name IN ('TwitchAlerts', 'UserInTwitchAlert', 'TeamInTwitchAlert', 'UserInTwitchTeam');"
    with session_manager() as session:
        tables_found = session.execute(sql_check_table_exists).all()
    for table in tables_found:
        assert table.name in tables
Пример #3
0
        return "<VoteTargetRoles(%s, %s)>" % \
               (self.vote_id, self.role_id)


@mapper_registry.mapped
class VoteOptions:
    __tablename__ = 'VoteOptions'
    vote_id = Column(Integer, primary_key=True)
    opt_id = Column(Integer, primary_key=True)
    option_title = Column(String, primary_key=True)
    option_desc = Column(String, primary_key=True)

    def __repr__(self):
        return "<VoteOptions(%s, %s, %s, %s)>" % \
               (self.vote_id, self.opt_id, self.option_title, self.option_desc)


@mapper_registry.mapped
class VoteSent:
    __tablename__ = 'VoteSent'
    vote_id = Column(Integer, primary_key=True)
    vote_receiver_id = Column(Integer, primary_key=True)
    vote_receiver_message = Column(Integer, primary_key=True)

    def __repr__(self):
        return "<VoteSent(%s, %s, %s)>" % \
               (self.vote_id, self.vote_receiver_id, self.vote_receiver_message)


setup()