ActiveRecord migrations are a convenient way to modify our database schema over time.
They allow us to create, modify, and manage database tables and columns, ensuring consistency across environments.
Before
Currently, ActiveRecord::Migration
has a weird behaviour where we can generate migrations with reserved keywords like attributes
, type
etc.
It generates the migration without any issues. But it raises error when we try to use it.
After
This problem is now fixed in Rails 7.1 with this PR#47752 where ActiveRecord::Migration
raises error when generating model attributes with reserved names
Now we can be sure that our migrations does not contain any reserved words and will not fail during migration because of it.