feat: persist player-scoped assignments

This commit is contained in:
Josh Creek
2026-08-31 23:19:23 +01:00
parent 7f7516d9a0
commit 3ae2daec88
5 changed files with 172 additions and 1 deletions
+10
View File
@@ -5,6 +5,7 @@ import unittest
SQL = (Path(__file__).parent / "0001_initial.sql").read_text()
ASSIGNMENTS_SQL = (Path(__file__).parent / "0002_assignments.sql").read_text()
class MigrationTest(unittest.TestCase):
@@ -43,6 +44,15 @@ class MigrationTest(unittest.TestCase):
self.assertIn("REFERENCES identities(player_id)", SQL)
self.assertIn("REFERENCES matches(match_id)", SQL)
def test_assignments_are_player_scoped_and_expiry_bound(self):
for fragment in (
"CREATE TABLE assignments", "PRIMARY KEY (match_id, player_id)",
"FOREIGN KEY (match_id, player_id)", "UNIQUE (match_id, slot)",
"join_authorisation TEXT NOT NULL", "expires_at TIMESTAMPTZ NOT NULL",
"assignments_player_expiry",
):
self.assertIn(fragment, ASSIGNMENTS_SQL)
if __name__ == "__main__":
unittest.main()