audit

MySQL auto-store datetime for each row

江枫思渺然 提交于 2019-11-26 19:06:04
问题 In MySQL, I'm sick of adding the columns dt_created and dt_modified (which are date time stamps for creation and last modified respectively) to all the tables I have in my database. Every time I INSERT or UPDATE the database, I will have to use the NOW() keyword. This is going all over my persistence. Is there any efficient alternative where MySQL can automatically store at least the datatime of the row that is inserted and let me retrieve it? 回答1: You can use DEFAULT constraints to set the

Implementing Audit Log / Change History with MVC & Entity Framework

隐身守侯 提交于 2019-11-26 18:37:42
I am building in a Change History / Audit Log to my MVC app which is using the Entity Framework. So specifically in the edit method public ActionResult Edit(ViewModel vm) , we find the object we are trying to update, and then use TryUpdateModel(object) to transpose the values from the form on to the object that we are trying to update. I want to log a change when any field of that object changes. So basically what I need is a copy of the object before it is edited and then compare it after the TryUpdateModel(object) has done its work. i.e. [HttpPost] public ActionResult Edit(ViewModel vm) { /

Data Auditing in NHibernate and SqlServer

六月ゝ 毕业季﹏ 提交于 2019-11-26 13:08:27
问题 I\'m using NHibernate on a project and I need to do data auditing. I found this article on codeproject which discusses the IInterceptor interface. What is your preferred way of auditing data? Do you use database triggers? Do you use something similar to what\'s dicussed in the article? 回答1: For NHibernate 2.0, you should also look at Event Listeners. These are the evolution of the IInterceptor interface and we use them successfully for auditing. 回答2: [EDIT] Post NH2.0 release, please look at

Database design for audit logging

拥有回忆 提交于 2019-11-26 12:49:11
问题 Every time I need to design a new database I spend quite some time thinking on how I should set up the database schema to keep an audit log of the changes. Some questions have already been asked here about this, but I don\'t agree that there is a single best approach for all scenarios: Database Design For Revisions Best design for a change log auditing database table Ideas on database design for capturing audit trails I have also stumbled upon this interesting article on Maintaining a Log of

Best design for a changelog / auditing database table? [closed]

淺唱寂寞╮ 提交于 2019-11-26 11:45:51
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . I need to create a database table to store different change log/auditing (when something was added, deleted, modified, etc). I don\'t need to store particularly detailed info, so I was thinking something along the lines of: id (for event) user that triggered it event name event

Ideas on database design for capturing audit trails [closed]

懵懂的女人 提交于 2019-11-26 09:19:00
问题 How can I maintain a log of the data in my DB? I have to maintain a log of every change made to each row. That means that I can\'t allow DELETE and UPDATE to be performed. How can I keep such a log? 回答1: Use "Insert Only Databases" The basic idea is that you never update or delete data. Each table has 2 datetime columns from and to . They start with the value null in each (beginning of time to end of time) When you need to "change" the row you add a new row, at the same time you update the to

Creating audit triggers in SQL Server

我的梦境 提交于 2019-11-26 07:23:41
问题 I need to implement change tracking on two tables in my SQL Server 2005 database. I need to audit additions, deletions, updates (with detail on what was updated). I was planning on using a trigger to do this, but after poking around on Google I found that it was incredibly easy to do this incorrectly, and I wanted to avoid that on the get-go. Can anybody post an example of an update trigger that accomplishes this successfully and in an elegant manner? I am hoping to end up with an audit table

Implementing Audit Log / Change History with MVC & Entity Framework

你说的曾经没有我的故事 提交于 2019-11-26 06:28:54
问题 I am building in a Change History / Audit Log to my MVC app which is using the Entity Framework. So specifically in the edit method public ActionResult Edit(ViewModel vm) , we find the object we are trying to update, and then use TryUpdateModel(object) to transpose the values from the form on to the object that we are trying to update. I want to log a change when any field of that object changes. So basically what I need is a copy of the object before it is edited and then compare it after