advertisement

Print

Cookin' with Ruby on Rails - May
Pages: 1, 2, 3, 4, 5, 6

Paul:  OK.  We've added a couple of columns.  What's the big deal?  I mean, other than that your scripts are database-independent and you don't have to remember how to write SQL scripts at all.  Not that I'm saying that those aren't real nice, you know.

CB (grinning from ear to ear at this point):  Remember, we're at Version 3 of the schema definition right now.   

Migration 3 schema defintion
Figure 26. (Click to enlarge.)

Our baseline is version 1, then we added the contributor_name column for Version 2, and then added the contributor_email for Version 3. So here comes the big deal...

Migrate back to Version 2.

Migrate back to Version 2
Figure 27. (Click to enlarge.)

Schema is automatically updated to the Version 2 structure.

Schema updated to Version 2
Figure 28. (Click to enlarge.)

Database structure is updated, without losing any of the remaining content.

Database for Version 2
Figure 29. (Click to enlarge.)

Migrate back to Version 1, our baseline schema.

Migrate back to Version 1
Figure 30. (Click to enlarge.)

Schema is automatically updated,

Schema updated to Version 1
Figure 31. (Click to enlarge.)

as is the database, again without losing any of the remaining content.

Database for Version 1
Figure 32. (Click to enlarge.)

Pages: 1, 2, 3, 4, 5, 6

Next Pagearrow