The problem of titles-to-lots
Posted by mholmes on 26 May 2014 in Activity log
It's increasingly clear that titles-to-lots needs to be a one-to-many relationship; more than six hundred titles have additional lots mentioned in their "Doc lots" field. I've been working on how this might be managed, using the dev version of the new db. I have a script which does a number of things to the db structure:
- Creates a new titles_to_properties table and populates it with records for all the existing title/property one-to-one relationships.
- Adds a new prp_desc field to the props table. This is necessary because it's not practical to use the props_abbr view in a one-to-many relationship; instead, we can dispense with that view and replace it with a description field.
- Populates the new field with existing data calculated from the block and lot fields (this may have to be more detailed, using other fields, since we'll actually be looking at non-Vancouver properties down the line, but it's easy to expand it).
- Adds triggers to update and insert which calculate this field before updating or inserting.
I've also updated the local_classes.php file to take account of this. Quick testing suggests this is working well (haven't tried an insert yet, though).
Once this is working in the live db, someone will have to go through and update all those hundreds of existing records, which will be very time-consuming. In most cases, new property items will have to be added to the props table.