Skip to content

Commit

Permalink
Bring back removal of translatable columns
Browse files Browse the repository at this point in the history
Globalize does not support having translatable columns with the same
name in the original table and the translations table. We were planning
to migrate to Mobility, but we aren't doing so before releasing version
1.1.

We've also found a gotcha regarding having both columns: if we use the
`update_column` method, which we use in rake tasks to speed up the
process and in tests where we want to skip validations and callbacks, we
update the column in the original table and no exception is raised. If
we remove the column in the original table, we get an exception, which
is what we want since our intention is to update the column in the
translations table.

With this change we're following the advice given by the Mobility lead
developer: "If you don't need the columns, I think it would make sense
to just remove them to avoid any edge case issues."

This commit reverts commit 251326e.
  • Loading branch information
javierm committed Nov 7, 2019
1 parent ed2d4dc commit 7a78776
Show file tree
Hide file tree
Showing 21 changed files with 151 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class RenameOldTranslatableAttibutesInDebates < ActiveRecord::Migration[4.2]
def change
remove_index :debates, :title

rename_column :debates, :title, :deprecated_title
rename_column :debates, :description, :deprecated_description
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class RenameOldTranslatableAttibutesInProposals < ActiveRecord::Migration[4.2]
def change
remove_index :proposals, :title
remove_index :proposals, :summary

rename_column :proposals, :title, :deprecated_title
rename_column :proposals, :description, :deprecated_description
rename_column :proposals, :summary, :deprecated_summary
rename_column :proposals, :retired_explanation, :deprecated_retired_explanation
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RenameOldTranslatableAttibutesInComments < ActiveRecord::Migration[4.2]
def change
rename_column :comments, :body, :deprecated_body
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class RenameOldTranslatableAttibutesInBudgetInvestments < ActiveRecord::Migration[4.2]
def change
rename_column :budget_investments, :title, :deprecated_title
rename_column :budget_investments, :description, :deprecated_description
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class RemoveDeprecatedTranslatableFieldsFromBanners < ActiveRecord::Migration[4.2]
def change
remove_column :banners, :title, :string
remove_column :banners, :description, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class RemoveDeprecatedTranslatableFieldsFromPolls < ActiveRecord::Migration[4.2]
def change
remove_column :polls, :name, :string
remove_column :polls, :summary, :text
remove_column :polls, :description, :text
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveDeprecatedTranslatableFieldsFromPollQuestions < ActiveRecord::Migration[4.2]
def change
remove_column :poll_questions, :title, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class RemoveDeprecatedTranslatableFieldsFromPollQuestionAnswers < ActiveRecord::Migration[4.2]
def change
remove_column :poll_question_answers, :title, :string
remove_column :poll_question_answers, :description, :text
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class RemoveDeprecatedTranslatableFieldsFromAdminNotifications < ActiveRecord::Migration[4.2]
def change
remove_column :admin_notifications, :title, :string
remove_column :admin_notifications, :body, :text
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class RemoveDeprecatedTranslatableFieldsFromMilestones < ActiveRecord::Migration[4.2]
def change
remove_column :milestones, :title, :string
remove_column :milestones, :description, :text
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class RemoveDeprecatedTranslatableFieldsFromLegislationDraftVersions < ActiveRecord::Migration[4.2]
def change
remove_column :legislation_draft_versions, :title, :string
remove_column :legislation_draft_versions, :changelog, :text
remove_column :legislation_draft_versions, :body, :text
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class RemoveDeprecatedTranslatableFieldsFromLegislationProcesses < ActiveRecord::Migration[4.2]
def change
remove_column :legislation_processes, :title, :string
remove_column :legislation_processes, :summary, :text
remove_column :legislation_processes, :description, :text
remove_column :legislation_processes, :additional_info, :text
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveDeprecatedTranslatableFieldsFromLegislationQuestions < ActiveRecord::Migration[4.2]
def change
remove_column :legislation_questions, :title, :text
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveDeprecatedTranslatableFieldsFromLegislationQuestionOptions < ActiveRecord::Migration[4.2]
def change
remove_column :legislation_question_options, :value, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class RemoveDeprecatedTranslatableFieldsFromSiteCustomizationPages < ActiveRecord::Migration[4.2]
def change
remove_column :site_customization_pages, :title, :string
remove_column :site_customization_pages, :subtitle, :string
remove_column :site_customization_pages, :content, :text
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class RemoveDeprecatedTranslatableFieldsFromWidgetCards < ActiveRecord::Migration[4.2]
def change
remove_column :widget_cards, :label, :string
remove_column :widget_cards, :title, :string
remove_column :widget_cards, :description, :text
remove_column :widget_cards, :link_text, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveDeprecatedTranslatableFieldsFromBudgets < ActiveRecord::Migration[4.2]
def change
remove_column :budgets, :name, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveDeprecatedTranslatableFieldsFromBudgetGroups < ActiveRecord::Migration[4.2]
def change
remove_column :budget_groups, :name, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveDeprecatedTranslatableFieldsFromBudgetHeadings < ActiveRecord::Migration[4.2]
def change
remove_column :budget_headings, :name, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class RemoveDeprecatedTranslatableFieldsFromBudgetPhases < ActiveRecord::Migration[4.2]
def change
remove_column :budget_phases, :summary, :text
remove_column :budget_phases, :description, :text
end
end
Loading

0 comments on commit 7a78776

Please sign in to comment.