server: auth schema, keys, sessions, connection registry (#17)
This commit is contained in:
+10
-5
@@ -38,19 +38,24 @@ suite "migrate":
|
||||
check migrate(db) == LatestVersion
|
||||
check LatestVersion == migrations[^1].version
|
||||
check schemaVersion(db) == LatestVersion
|
||||
check LatestVersion == 1
|
||||
check LatestVersion == 2
|
||||
let rows = appliedMigrations(db)
|
||||
check rows.len == 1
|
||||
check rows.len == 2
|
||||
check rows[0][0] == 1
|
||||
check rows[0][1] == "meta"
|
||||
# the step's own DDL ran: meta exists and is empty
|
||||
check rows[1][0] == 2
|
||||
check rows[1][1] == "auth"
|
||||
# the steps' own DDL ran: meta and the auth tables exist and are empty
|
||||
check db.getValue(sql"SELECT count(*) FROM meta") == "0"
|
||||
check db.getValue(sql"SELECT count(*) FROM player") == "0"
|
||||
check db.getValue(sql"SELECT count(*) FROM player_key") == "0"
|
||||
check db.getValue(sql"SELECT count(*) FROM session") == "0"
|
||||
|
||||
test "re-open is a no-op: no step applied, history and timestamps untouched":
|
||||
let d = tmpDir()
|
||||
block:
|
||||
let db = openFresh(d)
|
||||
check migrate(db) == 1
|
||||
check migrate(db) == 2
|
||||
close(db)
|
||||
let db = openFresh(d)
|
||||
defer:
|
||||
@@ -59,7 +64,7 @@ suite "migrate":
|
||||
let before = appliedMigrations(db)
|
||||
check migrate(db) == 0
|
||||
check migrate(db) == 0
|
||||
check schemaVersion(db) == 1
|
||||
check schemaVersion(db) == 2
|
||||
check appliedMigrations(db) == before
|
||||
|
||||
test "history and user_version must agree":
|
||||
|
||||
Reference in New Issue
Block a user