server: token records and the entity migration step (#20)
Migration step 4 ("tokens") creates the entity table: the token id, scene, kind,
both names, position, nullable radius/owner/vision_radius, gm_only and flags. A
NULL owner is GM-controlled, so player.remove hands that player's tokens to the GM
through the FK; radius, props and character_id stay out until slices 7-8.
server/tokens.nim holds the record, the 6.1 field rules (12 CSPRNG characters from
a 64-symbol alphabet, trimmed names, kind, positive vision_radius), the write-through
persistence (FULL for GM authoring, NORMAL for a move) and the loader. db_connector
quotes every argument, so the three nullable columns are emitted as numeric literals
while text still goes through ? arguments.
This commit is contained in:
+1
-1
@@ -153,7 +153,7 @@ proc patched*(w: WallRec, patch: WallPatch): WallRec =
|
||||
proc flagsText(node: JsonNode): string =
|
||||
if node.isNil: "{}" else: $node
|
||||
|
||||
template authoringTransaction(db: DbConn, body: untyped) =
|
||||
template authoringTransaction*(db: DbConn, body: untyped) =
|
||||
## GM authoring durability (Q12): `synchronous=FULL` for this transaction, `NORMAL` again
|
||||
## afterwards, whether the body succeeded or raised. `PRAGMA synchronous` cannot change inside a
|
||||
## transaction, so it brackets BEGIN/COMMIT; a failing body rolls back completely.
|
||||
|
||||
Reference in New Issue
Block a user