Skip to content

Commit a2007f6

Browse files
committed
Updated & reviewed logical delete pattern
1 parent 59fdd42 commit a2007f6

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

1000_Design_Patterns/Design Pattern - Generic - Handling Logical Deletes.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,24 @@ This also means that the new record which contains the
2121
For example:
2222
Initially a new record is inserted.
2323

24-
DWH_KEY | Logical Key | Name | Colour| Current |Deleted | Effective Date | Expiry Date
24+
DWH Key | Logical Key | Name | Colour| Current |Deleted | Effective Date | Expiry Date
2525
---|---|---|---|---|---|---|---
2626
1 | CHS | Cheese | YEL | Y| N | 10-01-2006| 31-12-9999
2727

28-
2928
After a while, the record is deleted from the source and captured using a CDC mechanism. The new row which represents the deleted record is inserted and the original row is updated for the current row indicator and expiry date.
30-
DWH_KEY Logical Key Name Colour Current Deleted Effective Date Expiry Date
31-
1
32-
CHS Cheese YEL N N 10-01-2006 04-02-2010
33-
2 CHS Cheese YEL Y Y 04-02-2010
34-
31-12-999
35-
9
29+
30+
DWH Key | Logical Key | Name | Colour| Current |Deleted | Effective Date | Expiry Date
31+
---|---|---|---|---|---|---|---
32+
1 | CHS | Cheese | YEL | N | N | 10-01-2006 | 04-02-2010
33+
2 | CHS | Cheese | YEL | Y | Y | 04-02-2010 | 31-12-9999
3634

3735
The Data Warehouse now contains all the correct information to reopen the record if that situation occurs.
38-
DWH_KEY Logical Key Name Colour Current Deleted Effective Date Expiry Date
39-
1
40-
CHS Cheese YEL N N 10-01-2006 04-02-2010
41-
2 CHS Cheese YEL Y Y 04-02-2010 02-06-2011
42-
3 CHS Cheese YEL Y N 02-06-2011 31-12-9999
36+
37+
DWH Key | Logical Key | Name | Colour| Current |Deleted | Effective Date | Expiry Date
38+
---|---|---|---|---|---|---|---
39+
1 | CHS | Cheese | YEL | N | N | 10-01-2006 | 04-02-2010
40+
2 | CHS | Cheese | YEL | Y | Y | 04-02-2010 | 02-06-2011
41+
3 | CHS | Cheese | YEL | Y | N | 02-06-2011 | 31-12-9999
4342

4443
The Deleted Row Indicator (‘Deleted’ in this example) keeps the design straightforward and provides the information that a record has been deleted from an effective date onwards including the image when it was deleted.
4544

0 commit comments

Comments
 (0)