TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

SQLite schema boilerplate for user accounts, roles, logins and auth tokens

58 点作者 koistya大约 9 年前

7 条评论

henrikschroder大约 9 年前
I hate to be that guy, but why is something as trivial and inflexible as this being voted up?<p>It&#x27;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?<p>Is this meant as a &quot;Here&#x27;s how you could model a database for doing this&quot;, 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?<p>Why is a user&#x27;s phone number so important that it&#x27;s part of this, but not a user&#x27;s last IP address or time of login?<p>Super confused here.
datashaman大约 9 年前
Your table naming convention needs work...<p><pre><code> User model -&gt; User table Role model -&gt; UserRole table UserRole model -&gt; UserUserRole table </code></pre> If you consider that User is the module, then your User table should be called UserUser if you want to be consistent.<p>But that&#x27;s silly.<p>Calling your module Auth would be better. Then the table names don&#x27;t contain RepeatedRepeated parts.<p>Or even better, don&#x27;t use the module name in the table name. It&#x27;s pretty clear what User, Role and UserRole mean just on their own.<p>And since you&#x27;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?
datashaman大约 9 年前
If you want something that is a lot more descriptive and generic, get your ideas from this.<p><a href="https:&#x2F;&#x2F;schema.org" rel="nofollow">https:&#x2F;&#x2F;schema.org</a>
cookiemonsta大约 9 年前
How is this on the front page?<p>Surely if you are coding something to use this, you would be able to write the 30-odd lines that these sql statements are...<p>also table names like &quot;UserUserRole&quot; don&#x27;t look right to me.
UnoriginalGuy大约 9 年前
Is there any documentation for this?<p>For example is &quot;securityStamp&quot; in User.sql designed to store the salt? Or is it something else entirely? There&#x27;s security stamps in other frameworks which are just unique values (e.g. UIDs) which just change when a user&#x27;s password changes so you can invalid old cookies without storing the hash within the cookie.<p>If there is no salt support at all then this is inappropriate in 2016 as boilerplate.
vhost-大约 9 年前
Why the camel cased columns?
评论 #11648271 未加载
评论 #11648214 未加载
评论 #11648436 未加载
Thetawaves大约 9 年前
Please do not use SQLite for multiuser systems. You will have a bad time.
评论 #11648218 未加载
评论 #11648171 未加载
评论 #11648216 未加载