You could if you are single developer or if you rely on db:setup
and db:seed
for all members of your team.
But if you plan to deploy your application to a production server you really should not, because migration are here to update the schema accordingly with the actual schema version of the targeted machine. With them, just the rights changes are applied. Without them, relying only on schema.rb
would force a complete reset of the database, emptying it. And that's not what we want most on the time on production servers.
Also migration are a useful reference for your database status while coding, they help to find quickly the list of fields of each models, in a more readable way than schema.rb
.
If you did never deploy you app to a production server and if you are single developer (or if other developers agree) you can refactor your migration by integrating all changes (add_field
...) in the original create_table
migration