Class: PufferPages::Globalize::Migrator

Inherits:
Globalize::ActiveRecord::Migration::Migrator
  • Object
show all
Defined in:
lib/puffer_pages/globalize/migrator.rb

Instance Method Summary collapse

Instance Method Details

#create_translation_tableObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/puffer_pages/globalize/migrator.rb', line 6

def create_translation_table
  connection.create_table(translations_table_name, id: false) do |t|
    t.uuid :id, primary_key: true
    t.uuid "#{table_name.sub(/^#{table_name_prefix}/, '').singularize}_id"
    t.string :locale
    fields.each do |name, options|
      if options.is_a? Hash
        t.column name, options.delete(:type), options
      else
        t.column name, options
      end
    end
    t.timestamps
  end
end