简体   繁体   中英

What is the best way (as in best practices) to implement a “System User” on the database level?

I'm building an application that imports a lot of its data from another source and so often I'll be writing data to a database table that expects a user_id on the row.

Since this data is being imported by the system and not an actual user, a user_id isn't necessarily available which brings me to my question. Should I create an actual system user on the users table or should I just allow the user_id field to be nullable which would indicate that the system imported that row?

IMO, you should specifically set the userid of whoever/whatever did the import.

It makes it possible to tell the difference between the system user and a failure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM