Rails schema not updating

24 Feb

Every now and again we need to change actual data in the production database.The first obvious option that comes to mind is to use a Rails migration, especially since the word “migration” is already in the task at hand, a “data migration.” But let’s talk about it some more and let me try to dissuade you from doing so.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.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.Looking the at Rails Guides for Active Records Migration, the first section starts by saying: Migrations are a feature of Active Record that allows you to evolve your database schema over time.

Hello, since upgrade to rails 4.2, everytime someone calls command "db: migrate", it randomly add or remove limit: 255 to every t.string column in whole db schema.Before Rails, most teams I encountered were in the habit of making incredibly error-prone ad hoc changes to each of their application's databases.It's one part of the framework I wish were emulated much more broadly than it has been.This includes both code snippets embedded in the card text and code that is included as a file attachment.Excepted from this license are code snippets that are explicitely marked as citations from another source.