Skip to content

Commit 3b0a3d3

Browse files
Initial introduction of models for sessions
This introduces the concept of a Session, which may or not map exactly to an actual session of matches, that a given collection of archives is used for. With thanks to James for design discussion. Co-Authored-By: James Seden Smith <[email protected]>
1 parent 88c61fd commit 3b0a3d3

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

code_submitter/tables.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,38 @@
3838
server_default=sqlalchemy.func.now(),
3939
),
4040
)
41+
42+
43+
# At the point of downloading the archives in order to run matches, you create a
44+
# Session. The act of doing that will also create the required ChoiceForSession
45+
# rows to record which items will be contained in the download.
46+
Session = sqlalchemy.Table(
47+
'session',
48+
metadata,
49+
sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True),
50+
sqlalchemy.Column('description', sqlalchemy.String, nullable=False),
51+
52+
sqlalchemy.Column('username', sqlalchemy.String, nullable=False),
53+
54+
sqlalchemy.Column(
55+
'created',
56+
sqlalchemy.DateTime(timezone=True),
57+
nullable=False,
58+
server_default=sqlalchemy.func.now(),
59+
),
60+
)
61+
62+
ChoiceForSession = sqlalchemy.Table(
63+
'choice_for_session',
64+
metadata,
65+
sqlalchemy.Column(
66+
'choice_id',
67+
sqlalchemy.ForeignKey('choice_history.id'),
68+
primary_key=True,
69+
),
70+
sqlalchemy.Column(
71+
'session_id',
72+
sqlalchemy.ForeignKey('session.id'),
73+
primary_key=True,
74+
),
75+
)

0 commit comments

Comments
 (0)