Files
nairobi/db/migrate/20200519120717_rename_columns_with_slash_characters.rb
Javi Martín d7d421b88f Rename columns with a slash in their names
These columns were causing Rails 5.2 to throw a warning when ordering by
them, as if they weren't valid column names:

DEPRECATION WARNING: Dangerous query method (method whose arguments are
used as raw SQL) called with non-attribute argument(s):
:"budget/investments_count". Non-attribute arguments will be disallowed
in Rails 6.0. This method should not be called with user-provided
values, such as request parameters or model attributes. Known-safe
values can be passed by wrapping them in Arel.sql().

This change also makes their names consistent with the rest of our
tables and columns.
2020-07-08 18:34:58 +02:00

10 lines
353 B
Ruby

class RenameColumnsWithSlashCharacters < ActiveRecord::Migration[5.1]
def change
change_table :tags do |t|
t.rename :"budget/investments_count", :budget_investments_count
t.rename :"legislation/proposals_count", :legislation_proposals_count
t.rename :"legislation/processes_count", :legislation_processes_count
end
end
end