Browse Source

rebuild migrations, update to 1.3

feature_tests
Burathar 4 years ago
parent
commit
4cbe0486ea
  1. 11
      app/models.py
  2. 2
      app/routes.py
  3. 1
      documentation/drm/database_schema1.3.drawio
  4. BIN
      documentation/drm/database_schema1.3.png
  5. 1
      documentation/drm/entity_relationship_diagram_v1.3.drawio
  6. BIN
      documentation/drm/entity_relationship_diagram_v1.3.png
  7. 42
      migrations/versions/b98d6f905471_update_up_to_1_3.py
  8. 56
      migrations/versions/db3681fb9273_add_game_and_player_model.py
  9. 5
      the_hunt.py

11
app/models.py

@ -33,7 +33,6 @@ class Game(db.Model): @@ -33,7 +33,6 @@ class Game(db.Model):
__tablename__ = 'game'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), index=True, unique=True, nullable=False)
password_hash = db.Column(db.String(128), nullable=False)
state = db.Column(db.Integer, server_default='1')
start_time = db.Column(db.DateTime)
end_time = db.Column(db.DateTime)
@ -51,10 +50,10 @@ class Game(db.Model): @@ -51,10 +50,10 @@ class Game(db.Model):
backref=db.backref('game', lazy='joined'))
class Player(db.Model):
__tablename = 'player'
__tablename__ = 'player'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), unique=True, nullable=False)
auth_hash = db.Column(db.String(128), unique=True, nullable=False)
auth_hash = db.Column(db.String(128), unique=True, nullable=True)
password_hash = db.Column(db.String(128))
games = db.relationship(
'Game',
@ -80,7 +79,7 @@ class Player(db.Model): @@ -80,7 +79,7 @@ class Player(db.Model):
back_populates='recipients')
class Objective(db.Model):
__tablename = 'objective'
__tablename__ = 'objective'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), nullable=False)
game_id = db.Column(db.Integer, db.ForeignKey('game.id'), nullable=False)
@ -93,7 +92,7 @@ class Objective(db.Model): @@ -93,7 +92,7 @@ class Objective(db.Model):
back_populates='objectives_found')
class Location(db.Model):
__tablename = 'location'
__tablename__ = 'location'
id = db.Column(db.Integer, primary_key=True)
player_id = db.Column(db.Integer, db.ForeignKey('player.id'), nullable=False)
longitude = db.Column(db.Numeric(precision=15, scale=10, asdecimal=False, decimal_return_scale=None),nullable=False) # maybe check asdecimal and decimal_return_scale later?
@ -101,7 +100,7 @@ class Location(db.Model): @@ -101,7 +100,7 @@ class Location(db.Model):
timestamp = db.Column(db.DateTime, server_default=func.now(), nullable=False)
class Notification(db.Model):
__tablename = 'notification'
__tablename__ = 'notification'
id = db.Column(db.Integer, primary_key=True)
game_id = db.Column(db.Integer, db.ForeignKey('game.id'), nullable=False)
message = db.Column(db.Text, nullable=False)

2
app/routes.py

@ -7,3 +7,5 @@ from app import app, db @@ -7,3 +7,5 @@ from app import app, db
def index():
message="Hello, World"
return render_template("index.html", title='Home', message=message)
#@app.route('/game/<game_name>/leader')

1
documentation/drm/database_schema1.3.drawio

@ -0,0 +1 @@ @@ -0,0 +1 @@
<mxfile host="office.sciuro.org" modified="2020-07-03T08:45:21.700Z" agent="Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" etag="t7xLPSoxBBwIS6-oHi87" version="12.8.6" type="device"><diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">7V1bU9s6EP41PML4buexCaWlpYUW2p7zxIhYJAbHCo4ohF9/5MRObEu242DHl7MzDBMriq/fflrvtysdqaPZ6ycfzaffiI3dI0WyX4/U0yNFMS2F/Q8alusGYyCvGya+Y6+bYg3XzhsOG6Ww9dmx8SLRkRLiUmeebBwTz8NjmmhDvk9ekt3uiZs86hxNMNdwPUYu3/rHsel03Wop5rb9M3Ym0+jIsjFYfzNDUefwShZTZJOXWJP68Ugd+YTQ9afZ6wi7wb2L7suf8+Uf9+LR+PTlx+IJ/Rp+vfn++3i9s7MyP9lcgo89uveu3x7vzz7/1h7+mV+d/XiRPn24+3J8bGjrff9F7nN4w65ctMR+eMl0Gd3HxYszc5HHtob3xKPX4Tcy2x5PHde+QEvyHJzdgqLxY7Q1nBLfeWP9kRt2Zl/7NISJYiR6XAe/ZM0Sa/XxgvW5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6pKgghBwfOYYA3n6IyLXoVnORPTp7+vpye3fmj940ZXB88/nPFzEX+TTQFYCPestHB5UUhLgTLF4AhLQXJHLNunuExKflfPRsoKN+09EhC5yEqOMrLoGOKqSjTkzGLfTsDD5HNRBdoMajae1FlXfVXqKOvajxEINUrAxCAnUbx8x8mqleb7HqYkZe8IME6iqDCkaWH1XdqFkbNgRaHNR09J2S9AMGFcSnzMt8QEmVUpKVgYn2O/KCSb5+EheiCv2lI2tHhz2vBvx9kOODnEBG1SHCrD3IuQcy2KZPCI2/3/loPv1GbBz0+A8=</diagram></mxfile>

BIN
documentation/drm/database_schema1.3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

1
documentation/drm/entity_relationship_diagram_v1.3.drawio

@ -0,0 +1 @@ @@ -0,0 +1 @@
<mxfile host="office.sciuro.org" modified="2020-07-03T08:49:58.453Z" agent="Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" etag="sDv-IB3oRJPoYf-b1URd" version="12.8.6" type="device"><diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">7V1de5u4Ev41eZ49F+kDAgS+jN2k2bNtNrtpTruXxMg2LUYu4NjeX3/Eh2yQsA02H7IhF60RWAbNzDujd0biRhnN1588czH7gi3k3ADJWt8oH28A0A1A/g0bNnEDHMhxw9Szrbgp1fBi/4uSRilpXdoW8jMXBhg7gb3INo6x66JxkGkzPQ+vspdNsJP91YU5RVzDy9h0+NZvthXM4lYD6Lv2R2RPZ/SXZTiIz8xNenHyJP7MtPAq1aTc3ygjD+Mg/jRfj5ATjh0dl2+/b745n3/CT//9y/9lvg7/+Pr0v9u4s4cyX9k+gofc4OSug6fH9Z+/wKPy7/r7k/HwaPv+5laJu343nWUyXsmzBhs6gMgi45kcYi+Y4Sl2Ted+1zr08NK1UPgzEjnaXfMZ4wVplEnjDxQEm0Q5zGWASdMsmDvJWeRad6GoyaGLXRS3PNiOk3Q5wW7wYM5tJ9TBEV56NvLITT6h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oCvn3VRao0bl0Do7r/F1MReQTlkgzybPj7zwDmx3mgGXJrIsBmNQufsoNitI0WYmfXr2LI9UOM0i2NSET7N0clkjNLIpFmr3reEDFI3gLIMPAtl5CqpAKayqGiAqryiu+N1SMlsqXNEebAqTvDQkxjbqCGVztubo4l4HCl2yKwyq8Rk70TLJZRhagXCuYriCDaGQomU1VGa7qLlKEua8pUkwhSyzDOYKShuYwuya9Po4cyRWnE7vO/1mhPF46YW5RjvnZWJXTi8DxrG1vfIUilZsXUGe8XIgo2qMKFxqXYuPLB1gM68+BFIDETbkt3zoSEqTmnoVKU15wBReJSgvboYT8nzRKfES4+SFC5/68vGyWChYvGRcMn3W0+snqyGtjBdEDSG/+ukFRVBN9KTrQbus83RUo1G7Dq4BJOQeIiJhFt1Cq3pPdVLYzi401hqI2ukYHd7l6gvyfZOMTbFNrq6dQ5dBNkZvnUPX1WtArb6mmYpTucwIW+dTOV83ZFIHHl7Jg7hj/g0FV4sUwiCD2DVFBWtcM8jQ3Zm3XrSiSJB4Rsu+BUlOlijWG8/0i8RTIw5bxx++7OJlhlcu6SzZHutvZFrdEQyd90pZ0wB01WBrgjLEDiH7xRBlHIVRNICsvrLsPCXkA8iXQOQq9rrwQWX32mwdyA3R0tl9IHkGPlzo20kNnjvPIatS8V5PV4XBBUsrtr5kychJGXexGJdbg9Q+zPPxegenT1Q8cjY71eibx1am66zHwfLx5f7X6/pZfb2fDG7PX7HcctUpOMbqFnsR7CmeMHdApdYC5ZMYFfZVa7JcLaVyaIwOO9171wqBone5sZyYAjx62BpwgFaAY1e0opeqWqkWBC7GuFXW3aTFfvTygXT4cgAPXJ5FDv7LWu6tHdsBuyoE4nPUL+E8LAacjkOL3CC07H8jekY4f2NHdLnklOoWE1VhuYAag0Vy6GEcpI2MDOPsC7ZQeMX/AQ==</diagram></mxfile>

BIN
documentation/drm/entity_relationship_diagram_v1.3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

42
migrations/versions/08f2f998a4f6_update_models_to_database_documentation_.py → migrations/versions/b98d6f905471_update_up_to_1_3.py

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
"""update models to database documentation 1.2
"""update up to 1.3
Revision ID: 08f2f998a4f6
Revises: db3681fb9273
Create Date: 2020-07-02 18:45:23.912159
Revision ID: b98d6f905471
Revises:
Create Date: 2020-07-03 11:23:06.765509
"""
from alembic import op
@ -10,14 +10,40 @@ import sqlalchemy as sa @@ -10,14 +10,40 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '08f2f998a4f6'
down_revision = 'db3681fb9273'
revision = 'b98d6f905471'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('game',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=False),
sa.Column('state', sa.Integer(), server_default='1', nullable=True),
sa.Column('start_time', sa.DateTime(), nullable=True),
sa.Column('end_time', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_game_name'), 'game', ['name'], unique=True)
op.create_table('player',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=False),
sa.Column('auth_hash', sa.String(length=128), nullable=True),
sa.Column('password_hash', sa.String(length=128), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('auth_hash'),
sa.UniqueConstraint('name')
)
op.create_table('game_player',
sa.Column('game_id', sa.Integer(), nullable=False),
sa.Column('player_id', sa.Integer(), nullable=False),
sa.Column('role', sa.String(length=16), nullable=True),
sa.ForeignKeyConstraint(['game_id'], ['game.id'], ),
sa.ForeignKeyConstraint(['player_id'], ['player.id'], ),
sa.PrimaryKeyConstraint('game_id', 'player_id')
)
op.create_table('location',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('player_id', sa.Integer(), nullable=False),
@ -83,4 +109,8 @@ def downgrade(): @@ -83,4 +109,8 @@ def downgrade():
op.drop_table('objective')
op.drop_table('notification')
op.drop_table('location')
op.drop_table('game_player')
op.drop_table('player')
op.drop_index(op.f('ix_game_name'), table_name='game')
op.drop_table('game')
# ### end Alembic commands ###

56
migrations/versions/db3681fb9273_add_game_and_player_model.py

@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
"""add game and player model
Revision ID: db3681fb9273
Revises:
Create Date: 2020-07-02 13:26:00.493728
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'db3681fb9273'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('game',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=False),
sa.Column('password_hash', sa.String(length=128), nullable=False),
sa.Column('state', sa.Integer(), nullable=True),
sa.Column('start_time', sa.DateTime(), nullable=True),
sa.Column('end_time', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_game_name'), 'game', ['name'], unique=True)
op.create_table('player',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=False),
sa.Column('auth_hash', sa.String(length=128), nullable=False),
sa.Column('password_hash', sa.String(length=128), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('auth_hash'),
sa.UniqueConstraint('name')
)
op.create_table('game_player',
sa.Column('game_id', sa.Integer(), nullable=True),
sa.Column('player_id', sa.Integer(), nullable=True),
sa.Column('role', sa.String(length=16), nullable=True),
sa.ForeignKeyConstraint(['game_id'], ['game.id'], ),
sa.ForeignKeyConstraint(['player_id'], ['player.id'], )
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('game_player')
op.drop_table('player')
op.drop_index(op.f('ix_game_name'), table_name='game')
op.drop_table('game')
# ### end Alembic commands ###

5
the_hunt.py

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
from app import app, db
#from app.models import User, Post
from app.models import Game, Player, Objective, Location, Notification
@app.shell_context_processor
def make_shell_context():
return {'db': db}
return {'db': db, 'Game' : Game, 'Player' : Player, 'Objective' : Objective,
'Location' : Location, 'Notification' : Notification}

Loading…
Cancel
Save