Hung Truong: The Blog!

Craigslist and Google Maps Mashup Thingy: Day 6 – MySQL Refactoring

April 12, 2007 | 1 Minute Read

One of the things I didn’t really care about when I was coming up with my Google Maps Craigslist mashup thing was the correctness of the database schema. I’ve written database schema before, but this time I just got sort of lazy. When porting the application to CakePHP, I realized it was a bad idea to slack off. Today I spent some time refactoring and adding a association table to the db.

I also learned some more MySQL syntax stuff. Previously, I had worked with Rails, which sort of handles the query making itself. Since I wrote a custom listing parser, I had to do some MySQL magic with JOINs and whatnot.

I also worked a lot on the Facebook puzzle that I wrote about earlier today. I came up with an approach that was better than the last one I came up with, but only slightly. It’s still in the range of O(n), so I’ll have to figure out the last “clever” thing before I’ve got it finished. It’s actually a lot more interesting now due to the efficiency constraints.