26 July 2004

Database Refactorings

Database refactoring is the process of modifying the database schema (tables, stored procedures, triggers, ...) to improve the design, while retaining both its behavioral and informational semantics.
The database refactoring is implemented as:
1) After application coded and database schema is developed and unit tested,  a refactoring is detected because of an error or a new requirement.
2) Choose the database refactoring
3) Determine data cleanup
4) Write Unit Tests
5) Implement the changes
6) Run Tests

The most common database refactorings are:
1) Add Default Value
2) Add Nullable Column
3) Drop Column
4) Make Column Non Nullable
5) Remove Default Value
6) Add Foreign Key Constraint
7) Add Unique Index
8) Drop Table
9) Make Column Nullable
10) Add Non Nullable Column
11) Update Data
12) Delete Data
13) Insert Data
14) Move Data

Database testing tools
spUnit - Stored Procedures Unit Tests
tsqlUnit - Transact-SQL Unit Tests
DBUnit - JUnit extension
utPLSQL - PL/SQL Unit Tests


References
Agile Data 
List Of Database Refactoring - Martin Fowler

Books
Agile Database Techniques

No comments: