models and migrations

22. March 2007, 22:41

I’ve recently climbed back in the saddle.

It seems that where I fell off earlier, before Christmas in fact, was in the tricky (for the uninitiated) area of working out the model for my app. With some lengthy and hard thinking I think I’ve figured out how all the entities relate to each other: e.g., how both users and groups can have many memberships; but a membership can only belong to one user and one group. I had to write it all down before it started making sense.

Now I have eight things that all need tables of their own. But no doubt this will change… and anticipating this Rails has “migrations”, a way to specify in code what the database should look like so that changes to the database can be made easily without having to worry about the different flavours of SQL that might be required to accomplish that (given that the app you are writing might be one day run on Oracle instead of MySQL… yeah right).

So that’s the next job: to learn about migrations.

Links

Next/Prev