Here??™s how to check
on that:
mysql> show tables;
Empty set (0.12 sec)
The migration code is run when you run rake db:migrate, resulting in the cows table
being created with the following columns:
mysql> describe cows;
+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | YES | | NULL | |
| breed | varchar(255) | YES | | NULL | |
| born_on | datetime | YES | | NULL | |
| milkable | tinyint(1) | YES | | NULL | |
+----------+--------------+------+-----+---------+----------------+
CHAPTER 3 ?– SETTING UP YOUR DATABASE 51
Additionally, if you now list the tables in your database, you can see that not only has the
cows table been created but an additional table as well:
mysql> show tables;
+-----------------------------+
| Tables_in_test2_development |
+-----------------------------+
| cows |
| schema_info |
+-----------------------------+
The schema_info table is a table used internally by the Active Record migrator.
Pages:
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156