Sha256: ef6d152e4eef459fbc7689ecba23828b21641756b52356239632969932b8c2ab

Contents?: true

Size: 976 Bytes

Versions: 5

Compression:

Stored size: 976 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   :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, :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

5 entries across 5 versions & 1 rubygems

Version Path
has_many_translations-0.3.8 generators/has_many_translations/templates/migration.rb
has_many_translations-0.3.7 generators/has_many_translations/templates/migration.rb
has_many_translations-0.3.6 generators/has_many_translations/templates/migration.rb
has_many_translations-0.3.4 generators/has_many_translations/templates/migration.rb
has_many_translations-0.3.3 generators/has_many_translations/templates/migration.rb