Use migrate_data option for globalize

This way the task to migrate the data doesn't have to be run manually if
these migrations weren't already executed.
This commit is contained in:
Javi Martín
2018-10-17 03:51:50 +02:00
parent a84a0f2b7d
commit be25e5fc45
10 changed files with 69 additions and 35 deletions

View File

@@ -1,9 +1,12 @@
class AddTranslateMilestones < ActiveRecord::Migration class AddTranslateMilestones < ActiveRecord::Migration
def self.up def self.up
Budget::Investment::Milestone.create_translation_table!({ Budget::Investment::Milestone.create_translation_table!(
{
title: :string, title: :string,
description: :text description: :text
}) },
{ migrate_data: true }
)
end end
def self.down def self.down

View File

@@ -6,7 +6,10 @@ class CreateI18nContentTranslations < ActiveRecord::Migration
reversible do |dir| reversible do |dir|
dir.up do dir.up do
I18nContent.create_translation_table! :value => :text I18nContent.create_translation_table!(
{ value: :text },
{ migrate_data: true }
)
end end
dir.down do dir.down do

View File

@@ -2,8 +2,11 @@ class AddBannerTranslations < ActiveRecord::Migration
def self.up def self.up
Banner.create_translation_table!( Banner.create_translation_table!(
{
title: :string, title: :string,
description: :text description: :text
},
{ migrate_data: true }
) )
end end

View File

@@ -2,10 +2,13 @@ class AddHomepageContentTranslations < ActiveRecord::Migration
def self.up def self.up
Widget::Card.create_translation_table!( Widget::Card.create_translation_table!(
{
label: :string, label: :string,
title: :string, title: :string,
description: :text, description: :text,
link_text: :string link_text: :string
},
{ migrate_data: true }
) )
end end

View File

@@ -2,9 +2,12 @@ class AddPollTranslations < ActiveRecord::Migration
def self.up def self.up
Poll.create_translation_table!( Poll.create_translation_table!(
{
name: :string, name: :string,
summary: :text, summary: :text,
description: :text description: :text
},
{ migrate_data: true }
) )
end end

View File

@@ -2,8 +2,11 @@ class AddAdminNotificationTranslations < ActiveRecord::Migration
def self.up def self.up
AdminNotification.create_translation_table!( AdminNotification.create_translation_table!(
{
title: :string, title: :string,
body: :text body: :text
},
{ migrate_data: true }
) )
end end

View File

@@ -2,7 +2,8 @@ class AddPollQuestionTranslations < ActiveRecord::Migration
def self.up def self.up
Poll::Question.create_translation_table!( Poll::Question.create_translation_table!(
title: :string { title: :string },
{ migrate_data: true }
) )
end end

View File

@@ -2,8 +2,11 @@ class AddPollQuestionAnswerTranslations < ActiveRecord::Migration
def self.up def self.up
Poll::Question::Answer.create_translation_table!( Poll::Question::Answer.create_translation_table!(
{
title: :string, title: :string,
description: :text description: :text
},
{ migrate_data: true }
) )
end end

View File

@@ -2,25 +2,33 @@ class AddCollaborativeLegislationTranslations < ActiveRecord::Migration
def self.up def self.up
Legislation::Process.create_translation_table!( Legislation::Process.create_translation_table!(
{
title: :string, title: :string,
summary: :text, summary: :text,
description: :text, description: :text,
additional_info: :text, additional_info: :text,
},
{ migrate_data: true }
) )
Legislation::Question.create_translation_table!( Legislation::Question.create_translation_table!(
title: :text { title: :text },
{ migrate_data: true }
) )
Legislation::DraftVersion.create_translation_table!( Legislation::DraftVersion.create_translation_table!(
{
title: :string, title: :string,
changelog: :text, changelog: :text,
body: :text, body: :text,
body_html: :text, body_html: :text,
toc_html: :text toc_html: :text
},
{ migrate_data: true }
) )
Legislation::QuestionOption.create_translation_table!( Legislation::QuestionOption.create_translation_table!(
value: :string { value: :string },
{ migrate_data: true }
) )
end end

View File

@@ -1,10 +1,14 @@
class AddTranslatePages < ActiveRecord::Migration class AddTranslatePages < ActiveRecord::Migration
def self.up def self.up
SiteCustomization::Page.create_translation_table!({ SiteCustomization::Page.create_translation_table!(
{
title: :string, title: :string,
subtitle: :string, subtitle: :string,
content: :text content: :text
}) },
{ migrate_data: true }
)
change_column :site_customization_pages, :title, :string, :null => true change_column :site_customization_pages, :title, :string, :null => true
end end