Multi-Column Table Keys

Created 2006-08-29 / Edited 2006-08-29

A little over a year ago I re-wrote the db-oop layer of my work project. The previous system was a bit much for me, and my replacement simplified things significantly (though surely at a run-time cost, but not noticeable to users).

Unfortunately I was designing pretty much all of the tables that the application used. I say unfortunately because it means that all of the tables were arranged in a way that I might generally arrange things -- each table had a single column primary key.

Well now we're moving to a new database system with which the app must interface. Besides gutting most of my app, it means that I now get to deal with tables which have two or more columns used to determinte a unique row.

Such a simple assumtion as a single-column primary key permiates the implementation much more deeply than I had originally guessed! I've got it working pretty well now, but at first it felt a bit overwhelming to have to tear apart this code on which everything depends and which hasn't needed to be touched for so long.