Remove test parts and adjust db
This commit is contained in:
parent
a8d3d3b3dc
commit
3b8e28b4f3
@ -35,13 +35,6 @@ if User.query.limit(1).first() is None:
|
||||
db.session.add(admin)
|
||||
db.session.commit()
|
||||
|
||||
for i in range(4):
|
||||
if User.query.get('leo'+str(i)) is None:
|
||||
leo = User(login='leo'+str(i), name='Leo '+str(i), level=levels_users['Can manage simple users'])
|
||||
leo.set_password('leo')
|
||||
db.session.add(leo)
|
||||
db.session.commit()
|
||||
|
||||
# Login management
|
||||
@login_manager.user_loader
|
||||
def load_user(user_id):
|
||||
@ -369,5 +362,5 @@ def delete_game(user=None, game=None):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
socketio.run(app, debug=True, host='0.0.0.0')
|
||||
socketio.run(app, debug=True, host='127.0.0.1')
|
||||
|
||||
|
12
db.py
12
db.py
@ -18,12 +18,12 @@ class User(UserMixin, db.Model):
|
||||
|
||||
__tablename__ = 'users'
|
||||
|
||||
login = db.Column(db.String(200),
|
||||
login = db.Column(db.String(100),
|
||||
primary_key=True)
|
||||
name = db.Column(db.String(200),
|
||||
name = db.Column(db.String(100),
|
||||
nullable=False,
|
||||
unique=False)
|
||||
password = db.Column(db.String(200),
|
||||
password = db.Column(db.String(100),
|
||||
primary_key=False,
|
||||
unique=False,
|
||||
nullable=False)
|
||||
@ -53,12 +53,12 @@ class Game(db.Model):
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True)
|
||||
name = db.Column(db.String(200))
|
||||
name = db.Column(db.String(100))
|
||||
players = relationship("Player")
|
||||
turn = db.Column(db.Integer, default=-8)
|
||||
atout = db.Column(db.String(1))
|
||||
preneur = db.Column(db.Integer)
|
||||
admin = db.Column(db.String(200), db.ForeignKey('users.login'))
|
||||
admin = db.Column(db.String(100), db.ForeignKey('users.login'))
|
||||
cards_to_distribute = db.Column(db.String(200))
|
||||
first_player = db.Column(db.Integer)
|
||||
start = db.Column(db.Boolean, default=False)
|
||||
@ -332,7 +332,7 @@ class Player(db.Model):
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True)
|
||||
game = db.Column(db.Integer, db.ForeignKey('games.id'))
|
||||
user = db.Column(db.Integer, db.ForeignKey('users.login'))
|
||||
user = db.Column(db.String(100), db.ForeignKey('users.login'))
|
||||
cards = db.Column(db.String(40))
|
||||
nr = db.Column(db.Integer, default=-1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user