Sha256: 11f18b1815af2c95599672e4650615d460132ee99711f272c60309710d7194f8

Contents?: true

Size: 988 Bytes

Versions: 4

Compression:

Stored size: 988 Bytes

Contents

class CreateTranslations < ActiveRecord::Migration
  def self.up    # 
    create_table :translation_specs do |t|
      t.belongs_to :translated, :polymorphic => true
      t.string   :codes
    end
    add_index :translation_specs, :codes
    add_index :translation_specs, [:translated_id, :translated_type]
    
    create_table :translations do |t|
      t.belongs_to :translated, :polymorphic => true
      t.string   :model_attribute
      t.text     :value
      t.string   :locale_code
      t.string   :locale_name
      t.string   :origin_locale_code
      t.boolean  :machine_translation
      t.timestamps
    end
    add_index :translations, [:locale_code, :model_attribute]
    add_index :translations, [:translated_id, :translated_type]
    
    change_table :users do |t|
      add_column :users, :prefered_language, :string
    end
  end

  def self.down
    drop_table :translation_spec
    drop_table :translations
    remove_column :users, :prefered_language
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
has_many_translations-0.4.6 generators/has_many_translations/templates/migration.rb
has_many_translations-0.4.5 generators/has_many_translations/templates/migration.rb
has_many_translations-0.4.4 generators/has_many_translations/templates/migration.rb
has_many_translations-0.4.3 generators/has_many_translations/templates/migration.rb