且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

数据库设计 - 揭露主键

更新时间:2023-02-08 16:51:53

p>我建议不要添加一个新的字段,但也不要暴露Id。

I'd suggest not adding a new field, but also don't expose the Id.

创建一个表来存储您发送的电子邮件。将GUID作为主键,将UserId作为外键。在您提供给他们的网址中,链接回GUID。然后,如果用户点击URL,您可以根据GUID更新记录,并指示用户何时访问该URL。

Create a table to store emails that you send out. Include a GUID as the primary key and UserId as a foreign key. In the URL you are giving them, link back to the GUID. Then if a user clicks on a URL you can updated the record based on the GUID and indicate when the user accessed the URL.