添加“软删除”到现有系统
例如,我有一个包含大量存储过程、运行 TableA
的函数的系统。我们需要一种能够删除这些订单但保留它们记录的方法。
我们考虑过的一个选项是在 TableA
中添加一个 Delete
字段,然后遍历所有存储过程和函数添加:
WHERE Deleted=0
我们考虑过的另一个选项是创建一个名为类似的视图v_TableA
然后遍历并更改所有存储过程和函数以从此视图而不是表中读取。
两者都涉及大量工作,并且在将来对系统进行更改时需要记住它们。
我希望有更好的方法来做到这一点,例如:
SOFTDELETE FROM TableA
但我知道这是不可能的。任何帮助将不胜感激。
I have a system which contains a lot of stored procedures, functions which run of TableA
, for example. We need a way of being able to delete these orders, but keeping them on record.
One option we've considered is having a Delete
field in TableA
then go through all the sprocs and functions adding:
WHERE Deleted=0
Another option we've considered is creating a view called something like v_TableA
then going through and changing all the sprocs and functions to read from this view, rather than the table.
Both involve a lot of work, and will need to be remembered when making future changes to the system.
I'm hoping there is a better way of doing this something like:
SOFTDELETE FROM TableA
But I know this isn't possible. Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论