from app import db from app.models import Role class GamePlayer(db.Model): __tablename__ = 'game_player' game_id = db.Column(db.Integer, db.ForeignKey('game.id'), primary_key=True, nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True, nullable=False) role = db.Column(db.Enum(Role), server_default=Role(0).name, nullable=False) game = db.relationship('Game', back_populates='game_players') user = db.relationship('User', back_populates='user_games')