As we build our migrations,
we will be continuously switching between our database schema and our Active Record schema.
While this switching back and forth between database and Active Record schema will often be
transparent to you, the developer, it nonetheless occurs quite often and is accomplished primarily
through the ActiveRecord::SchemaDumper class.
CHAPTER 3 ?– SETTING UP YOUR DATABASE 46
?– Note We??™ll use ActiveRecord::SchemaDumper at various points in our examples later in the chapter to
show just in what state our database schema is at a given time.
Finally, we have the actual migration wrapper class. This is where all the parts we??™ve talked
about previously come together and our scripts come to life.
The important thing to remember is that migrations involve a DSL and act as a wrapper,
or glue, for the other pieces of our database to set up the code and DSL we??™ve mentioned previously.
We should also mention that, because migrations abstract the details of working with
your specific database, they rely heavily on each database adapter to perform many of the
database-specific functions (that is, to do the actual conversion from the migration DSL to the
database-specific SQL that will be executed against the database).
Pages:
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145