[nycphp-talk] data modelling vs. db design
Mitch Pirtle
mitch.pirtle at gmail.com
Tue Oct 4 22:04:30 EDT 2005
On 10/4/05, Russ Demarest <rsd at electronink.com> wrote:
>
> Don't get me started if you need to track history. "Where did user X
> live at home 2 years ago?". Then you have a start_date and end_date
> in the user_addresses.
This is one of the main reasons I look for support for Stored
Procedures and Triggers. With those two available, versioning can be
automated and absolutely zero hassle to the programmer.
For example, you could add begin_date and end_date in the user_address
table, and then create a trigger that fired on INSERT statements that
setup the proper values for each (as well as an UPDATE trigger that
also updates the values). You could also add address_status instead,
if you wanted to track without dates if that direction suits your
purposes better.
In the end, you can put that work in the database, where IMHO it belongs.
-- Mitch
More information about the talk
mailing list