SQLite schema boilerplate for user accounts, roles, logins and auth tokens
github.com
github.com
It's the schema for the user accounts and logins for a specific application, but without the actual application or documentation that would explain what the idea of each table and column is?
Is this meant as a "Here's how you could model a database for doing this", why is it lacking any explanations on how to use it, justifications for the choices, or examples on how the UI flow would look like?
Why is a user's phone number so important that it's part of this, but not a user's last IP address or time of login?
Super confused here.
User model -> User table
Role model -> UserRole table
UserRole model -> UserUserRole table
If you consider that User is the module, then your User table should be called UserUser if you want to be consistent.But that's silly.
Calling your module Auth would be better. Then the table names don't contain RepeatedRepeated parts.
Or even better, don't use the module name in the table name. It's pretty clear what User, Role and UserRole mean just on their own.
And since you're considering using SQLite as the DB, your system will (hopefully) be small enough not to worry about naming collisions, so why bother with module scoping the tables at all?
Surely if you are coding something to use this, you would be able to write the 30-odd lines that these sql statements are...
also table names like "UserUserRole" don't look right to me.
For example is "securityStamp" in User.sql designed to store the salt? Or is it something else entirely? There's security stamps in other frameworks which are just unique values (e.g. UIDs) which just change when a user's password changes so you can invalid old cookies without storing the hash within the cookie.
If there is no salt support at all then this is inappropriate in 2016 as boilerplate.
https://github.com/membership/membership.db/tree/master/post...
Better databases have row level locking which allows many users to update the same table at the same time.
- And this isn't all that strange, say you wanted to store a timestamp for the last time a user visited your site, session ids, etc.
UPD: Good explanation http://sqlite.org/whentouse.html
Nitpick: Databases that make different tradeoffs have row level locking. SQlite is very good, for the niche that it's in, which is a lightweight, embeddable database for primarily single-user applications. It's incredibly popular in that space, to the point of likely being the most-used database on the planet by number of running instances since it's in so many smartphones/embedded devices.