Browse Source

Merge branch 'master' of git.sciuro.org:Burathar/The-Hunt

feature_tests
Burathar 5 years ago
parent
commit
5924fcb911
  1. 4
      app/models.py
  2. 4
      migrations/versions/68009992b106_update_up_to_1_3_association_tables.py

4
app/models.py

@ -23,7 +23,7 @@ class GamePlayer(db.Model):
__tablename__ = 'game_player' __tablename__ = 'game_player'
game_id = db.Column(db.Integer, db.ForeignKey('game.id'), primary_key=True, nullable=False) game_id = db.Column(db.Integer, db.ForeignKey('game.id'), primary_key=True, nullable=False)
player_id = db.Column(db.Integer, db.ForeignKey('player.id'), primary_key=True, nullable=False) player_id = db.Column(db.Integer, db.ForeignKey('player.id'), primary_key=True, nullable=False)
role = db.Column(db.Enum(Role), server_default=Role(0).name) role = db.Column(db.Enum(Role), server_default=Role(0).name, nullable=False)
game = db.relationship('Game', back_populates='game_players') game = db.relationship('Game', back_populates='game_players')
player = db.relationship('Player', back_populates='player_games') player = db.relationship('Player', back_populates='player_games')
@ -57,7 +57,7 @@ class Game(db.Model):
__tablename__ = 'game' __tablename__ = 'game'
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), index=True, unique=True, nullable=False) name = db.Column(db.String(64), index=True, unique=True, nullable=False)
state = db.Column(db.Enum(GameState), server_default=GameState(1).name) state = db.Column(db.Enum(GameState), server_default=GameState(1).name, nullable=False)
start_time = db.Column(db.DateTime) start_time = db.Column(db.DateTime)
end_time = db.Column(db.DateTime) end_time = db.Column(db.DateTime)
game_players = db.relationship( game_players = db.relationship(

4
migrations/versions/68009992b106_update_up_to_1_3_association_tables.py

@ -21,7 +21,7 @@ def upgrade():
op.create_table('game', op.create_table('game',
sa.Column('id', sa.Integer(), nullable=False), sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=False), sa.Column('name', sa.String(length=64), nullable=False),
sa.Column('state', sa.Enum('initiated', 'published', 'started', 'interrupted', 'finished', name='gamestate'), server_default='initiated', nullable=True), sa.Column('state', sa.Enum('initiated', 'published', 'started', 'interrupted', 'finished', name='gamestate'), server_default='initiated', nullable=False),
sa.Column('start_time', sa.DateTime(), nullable=True), sa.Column('start_time', sa.DateTime(), nullable=True),
sa.Column('end_time', sa.DateTime(), nullable=True), sa.Column('end_time', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id') sa.PrimaryKeyConstraint('id')
@ -39,7 +39,7 @@ def upgrade():
op.create_table('game_player', op.create_table('game_player',
sa.Column('game_id', sa.Integer(), nullable=False), sa.Column('game_id', sa.Integer(), nullable=False),
sa.Column('player_id', sa.Integer(), nullable=False), sa.Column('player_id', sa.Integer(), nullable=False),
sa.Column('role', sa.String(length=16), nullable=True), sa.Column('role', sa.Enum('none', 'owner', 'hunter', 'bunny', name='role'), server_default='none', nullable=False),
sa.ForeignKeyConstraint(['game_id'], ['game.id'], ), sa.ForeignKeyConstraint(['game_id'], ['game.id'], ),
sa.ForeignKeyConstraint(['player_id'], ['player.id'], ), sa.ForeignKeyConstraint(['player_id'], ['player.id'], ),
sa.PrimaryKeyConstraint('game_id', 'player_id') sa.PrimaryKeyConstraint('game_id', 'player_id')

Loading…
Cancel
Save