Managing Your Database with Migrations
Before we get into the details of using Active Record migrations and show you some example
code, we need to get a few key definitions out of the way. First, just what are Active Record
migrations? The following is our plain English base definition: Active Record migrations offer
a pure Ruby solution to managing the creation and evolution of database schema.
From a more technical point of view, migrations come in the form of a Domain Specific
Language (DSL) that is expressly created for abstracting out the differences in database definitions
and managing changes of the database and its tables. In case you are not familiar with
what a DSL is, Wikipedia defines DSL as ???a programming language designed for, and intended
to be used for, a specific kind of task??? (see http://en.wikipedia.org/wiki/Domain_Specific_
Language for more Wikipedia information on DSL).
We think that??™s a pretty clear definition, but we??™ll take it a few steps further to be specific
within our realm. As Active Record developers, our migration DSL is a set of Ruby instructions
or modules that allow us to create more Ruby programs that we use to build and manage our
database schema.
Pages:
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143