Reputation: 168
Is there a design pattern to consider when building a data model for a banking application that requires data changes to go through an authorization level?
For example, if admin1 changes the telephone number for customer1, the change should not be effective until admin2 authorizes it.
The solution we plan to implement is to have a temp table to hold the changed record with the changed values and once the authorizer approves the change, then we update the main table. This works fine when you have few tables, but would be cumbersome as tables increase.
Upvotes: 3
Views: 1395
Reputation: 1902
I designed something like this and here's the gist of it;
Hope this helps...
Upvotes: 0
Reputation: 4876
This works fine when you have few tables, but would be cumbersome as tables increase
Not necessarily. It will work fine with a large amount of tables if you design it properly. You can build a nice and small data model just to hold the changes. It doesn't require you to create a copy of each table.
e.g. You can have a tables like: AuditTables, AuditColumns, AuditChanges, AuditChangesDetails etc. and you can store all changes you need in that model, rather than create a temp table which corresponds with the "live" table.
Upvotes: 1
Reputation: 6742
I'm not aware of any design pattern, but I think I might have another idea for you-
have just one other table, called 'Pending_Changes'
with columns 'Table_Identifier'
, 'Column_Identifier'
'Record_Identifier'
and 'New_Value'
.
Each row will represent a single column change to some record at some table.
For example- a row with values of ('Customers', 'Phone_Number', '12345', '077-4453432')
would be used to represent a change in the phone number of customer 12345.
The couple of downsides of this method is that-
1. all your tables must have a single ID field
2. a change to a single record can span multiple rows in the PendingChanges table, since it keeps a row for every changed column value.
On the upside- it's quite extensible and fairly easy to maintain.
Upvotes: 1