I would like to get some database design tips. In particular, consider the following (hypothetical) scenario:
, , , Users, . , ON DELETE CASCADE FK EmployeeID Employees Users.
Users
ON DELETE CASCADE
EmployeeID
Employees
UserLog, , , , .
UserLog
UserLog, . ?
.. /googled online, , , , ...
.
" " , "DeletedDate" "". UserLog, , , .
, .
, . - , . ( ) / .
, . -. - , , .
. , - IsActive IsDeleted, , , .
, , , UserLog , , , .
, , , - , , .
, , ( ) , .
. , - employee - UserLog. , , , . ? . , ? , . - EmployeeID , . . , .
, , . , .., , . , ( , , ), , , , . . FK , , , .
Cascade Delete . , , , , , , FK , . , - .
, , Users bool Deleted Disabled.
EmployeeId UserLog.
, , . , , logintime, logouttime, sessionlength .
? , , . , , - . , , , .
, , , . , . , "" , -.
, , , EmployeeID , Employee. , , . , , EmployeeID .
Employee
, active, , . , .
active
IANADBA, but it is generally thought that it’s very bad practice to really delete almost anything from the database ever. It would be much better to have some kind of locked flag / "remote" datestamp in your user table and save your FK.
Source: https://habr.com/ru/post/1781855/More articles:Using malloc () and sizeof () to create a structure on the heap - c ++File caching for subsequent rebuilds with distutils - pythonWindows service does not start after installation - c #Why does the ON DUPLICATE KEY UPDATE statement increment by 2 instead of 1? - mysqlCancel a blur handler based on the item that was clicked - jqueryjavascript unload event in Safari mobile? - jqueryWordpress XMLRPC возвращается пустым, но успешно - phpJava converts time format to integer or long - javaИспользуя find_if на карте, чтобы найти по значению - c++"Cannot find configuration source" when using XMLConfiguration Commons configuration using Tomcat - javaAll Articles