The migration DSL is like a language within a language. It is how we interact
with our database without having to actually learn everything about our database environment
and without having to do anything directly within our database application.
For us, the key to working with our migration DSL is to learn the keywords and their
related actions. The rest is all Ruby syntax (which you already know) and database design theory
(we covered the basic rules for this at the start of this chapter and have hopefully defined it
in more detail as part of our application specifications before we sat down and started to write
any code).
How the DSL Works
The DSL essentially enables us to map our database schema to an Active Record schema. The
documentation for Active Record Schema states this:
Active Record Schema allows programmers to programmatically define a schema in
a portable DSL. This means you can define tables, indexes, etc. without using SQL
directly, so your applications can more easily support multiple databases.
What this really means is that the ActiveRecord::Schema class is where all the real action
of your database schema definitions and maintenance happens.
Pages:
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144