Chapter 1: Evolutionary Database Development 1
1.1 Database Refactoring 3
1.2 Evolutionary Data Modeling 4
1.3 Database Regression Testing 6
1.4 Configuration Management of Database Artifacts 9
1.5 Developer Sandboxes 10
1.6 Impediments to Evolutionary Database Development Techniques 11
1.7 What You Have Learned 12
Chapter 2: Database Refactoring 13
2.1 Code Refactoring 13
2.2 Database Refactoring 14
2.2.1 Single-Application Database Environments 15
2.2.2 Multi-Application Database Environments 18
2.2.3 Maintaining Semantics 20
2.3 Categories of Database Refactorings 22
2.4 Database Smells 22
2.5 How Database Refactoring Fits In 25
2.6 Making It Easier to Refactor Your Database Schema 27
2.7 What You Have Learned 28
Chapter 3: The Process of Database Refactoring 29
3.1 Verify That a Database Refactoring Is Appropriate 32
3.2 Choose the Most Appropriate Database Refactoring 33
3.3 Deprecate the Original Database Schema 34
3.4 Test Before, During, and After 37
3.4.1 Testing Your Database Schema 37
3.4.2 Validating Your Data Migration 38
3.4.3 Testing Your External Access Programs 40
3.5 Modify the Database Schema 40
3.6 Migrate the Source Data 43
3.7 Refactor External Access Program(s) 44
3.8 Run Your Regression Tests 45
3.9 Version Control Your Work 45
3.10 Announce the Refactoring 46
3.11 What You Have Learned 47
Chapter 4: Deploying into Production 49
4.1 Effectively Deploying Between Sandboxes 50
4.2 Applying Bundles of Database Refactorings 51
4.3 Scheduling Deployment Windows 53
4.4 Deploying Your System 54
4.5 Removing Deprecated Schema 56
4.6 What You Have Learned 56
Chapter 5: Database Refactoring Strategies 59
5.1 Smaller Changes Are Easier to Apply 60
5.2 Uniquely Identify Individual Refactorings 60
5.3 Implement a Large Change by Many Small Ones 62
5.4 Have a Database Configuration Table 63
5.5 Prefer Triggers over Views or Batch Synchronization 63
5.6 Choose a Sufficient Transition Period 65
5.7 Simplify Your Database Change Control Board (CCB) Strategy 65
5.8 Simplify Negotiations with Other Teams 65
5.9 Encapsulate Database Access 66
5.10 Be Able to Easily Set Up a Database Environment 66
5.11 Do Not Duplicate SQL 67
5.12 Put Database Assets Under Change Control 67
5.13 Beware of Politics 68
5.14 What You Have Learned 68 Online Resources 68
Chapter 6: Structural Refactorings 69
Common Issues When Implementing Structural Refactorings 70
Drop Column 72
Drop Table 77
Drop View 79
Introduce Calculated Column 81
Introduce Surrogate Key 85
Merge Columns 92
Merge Tables 96
Move Column 103
Rename Column 109
Rename Table 113
Rename View 117
Replace LOB With Table 120
Replace Column 126
Replace One-To-Many With Associative Table 130
Replace Surrogate Key With Natural Key 135
Split Column 140
Split Table 145
Chapter 7: Data Quality Refactorings 151
Common Issues When Implementing Data Quality Refactorings 152
Add Lookup Table 153
Apply Standard Codes 157
Apply Standard Type 162
Consolidate Key Strategy 168
Drop Column Constraint 172
Drop Default Value 174
Drop Non-Nullable 177
Introduce Column Constraint 180
Introduce Common Format 183
Introduce Default Value 186
Make Column Non-Nullable 189
Move Data 192
Replace Type Code With Property Flags 196
Chapter 8: Referential Integrity Refactorings 203
Add Foreign Key Constraint 204
Add Trigger For Calculated Column 209
Drop Foreign Key Constraint 213
Introduce Cascading Delete 215
Introduce Hard Delete 219
Introduce Soft Delete 222
Introduce Trigger For History 227
Chapter 9: Architectural Refactorings 231
Add CRUD Methods 232
Add Mirror Table 236
Add Read Method 240
Encapsulate Table With View 243
Introduce Calculation Method 245
Introduce Index 248
Introduce Read-Only Table 251
Migrate Method From Database 257
Migrate Method To Database 261
Replace Method(s) With View 265
Replace View With Method(s) 268
Use Official Data Source 271
Chapter 10: Method Refactorings 277
10.1 Interface Changing Refactorings 277
10.1.1 Add Parameter 278
10.1.2 Parameterize Method 278
10.1.3 Remove Parameter 279
10.1.4 Rename Method 279
10.1.5 Reorder Parameters 281
10.1.6 Replace Parameter with Explicit Methods 282
10.2 Internal Refactorings 283
10.2.1 Consolidate Conditional Expression 283
10.2.2 Decompose Conditional 284
10.2.3 Extract Method 285
10.2.4 Introduce Variable 287
10.2.5 Remove Control Flag 289
10.2.6 Remove Middle Man 289
10.2.7 Rename Parameter 290
10.2.8 Replace Literal with Table Lookup 290
10.2.9 Replace Nested Conditional with Guard Clauses 292
10.2.10 Split Temporary Variable 292
10.2.11 Substitute Algorithm 293
Chapter 11: Transformations 295
Insert Data 296
Introduce New Column 301
Introduce New Table 304
Introduce View 306
Update Data 310
Appendix: The UML Data Modeling Notation 315
Glossary 321
References and Recommended Reading 327
Index 331