Automaticly generate hash for models #11

Open
opened 4 years ago by Burathar · 0 comments
Burathar commented 4 years ago
Owner

Player.auth_hash and Objective.hash are random fields that should be occupied with a random hash (token_hex(16)) when created. Right now this has to be called explicitly (set_auth_hash() and set_hash() respectively). Because this is prone to programmer error, I'd rather the hash is automaticly generated at creation of the entity.
The db.Column(default=token_hex(16)) method does not work; SqlAlchemy seems to run this function only once for each time the server starts, resulting in duplicate hashes.

Player.auth_hash and Objective.hash are random fields that should be occupied with a random hash (token_hex(16)) when created. Right now this has to be called explicitly (set_auth_hash() and set_hash() respectively). Because this is prone to programmer error, I'd rather the hash is automaticly generated at creation of the entity. The db.Column(default=token_hex(16)) method does not work; SqlAlchemy seems to run this function only once for each time the server starts, resulting in duplicate hashes.
Burathar added the
enhancement-should
label 4 years ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.