简体   繁体   中英

SQL Server 2016 temporal tables design best practice

with SQL Server 2016 temporal table feature available what is best practice to model for soft deleting a row feature. eg below are 2 different cases.

  1. customer, order, orderline tables are there and if I delete customer should i do soft delete by adding isDeleted column? Or do hard delete with backing of temporal tables? if i use temporal then what if i need to undelete that customer and his orders, orderlines.

  2. role, permission, rolepermission table is there. Now if someone changes role permissions should I clear all permission for the role in rolepermission table and add fresh entries? Or should we implement isdelete column in rolepermission table and do upsert instead of hard delete.

am not good at db design and wanted some expert to point me in right direction.

for now we are doing soft delete in all tables and using this library to ensure we dont have to write lot of isdelete filter in ef code.

https://github.com/zzzprojects/EntityFramework-Plus

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