Rails schema not updating karen o and nick zinner dating
Generally speaking, manipulating data in migrations is a bad idea for a few reasons.For one, data migrations files will stay in the directory for posterity, and will run whenever a new developer sets their local development environment. For example, future changes to a class and its logic can easily break the migration later on.Have you noticed that the word “data” is absent in the above paragraph?By definition, Rails migrations should only be used for schema changes and not for actual data changes in the database.Many projects rely on some kind of initial data, a list of products for an e-commerce shop, a list of post categories in a blog, or a set of user roles, for instance.
Rather than write schema modifications in pure SQL, migrations allow you to use an easy Ruby DSL to describe changes to your tables.
Furthermore, this is not business logic and thus should not stay forever in the code base.
A second issue is that those data migrations might be ignored by future developers if instead of running file without touching the migrations.
Just as schema migrations apply incremental changes to your database, seed migrations apply incremental data updates.
A few examples of real world seed migrations: Applying those migrations will automatically update the seeds file with instructions to recreate all the objects.