Class: CreateGlobalizeTranslations

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/single_table_globalize3/templates/migration.rb

Instance Method Summary collapse

Instance Method Details

#downObject



16
17
18
19
20
21
# File 'lib/generators/single_table_globalize3/templates/migration.rb', line 16

def down
  remove_index :globalize_translations, :name => :index_globalize_translalation_3
  remove_index :globalize_translations, :name => :index_globalize_translalation_2
  remove_index :globalize_translations, :name => :index_globalize_translalation_1
  drop_table :globalize_translations
end

#upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/single_table_globalize3/templates/migration.rb', line 2

def up
  create_table :globalize_translations do |t|
    t.integer :translatable_id
    t.string :translatable_type
    t.string :locale
    t.string :attribute_name
    t.text :value
    t.timestamps
  end
  add_index :globalize_translations, [:translatable_id, :translatable_type], :name => :index_globalize_translalation_1
  add_index :globalize_translations, [:translatable_id, :translatable_type, :locale], :name => :index_globalize_translalation_2
  add_index :globalize_translations, [:translatable_id, :translatable_type, :locale, :attribute_name], :name => :index_globalize_translalation_3
end