TecKnow / muster-tools

A package for assigning players to tables at multi-table, walk-in gaming events.
GNU General Public License v3.0
0 stars 0 forks source link

Automatic table naming won't work when tables are deleteable #15

Closed TecKnow closed 3 years ago

TecKnow commented 3 years ago

https://github.com/TecKnow/muster-tools/blob/c7bb0807f705c3042d794bf903a4bb22000bbe3d/muster_server/src/sequelize/index.js#L50-L50

TecKnow commented 3 years ago

It turns out SQLite treats INTEGER PRIMARY KEY columns as aliases for the ROWID which is unique, and on INSERT is usually assigned a default value of one higher than the highest value currently in use. Adding the AUTOINCREMENT keyword prevents values from being reused even if the row with that ROWID is deleted from the table.

See here: SQLite Autoincrement for the relevant SQLite documentation.

As long as the tableID is returned by the server in the event it broadcasts to clients to create the table, this shouldn't be an issue.

This may be an issue if the client implementation chooses the tableID, so this should be avoided if possible and improved if necessary.