Sha256: 6d2e4dfb3c4ff60e68430e487a72369376b4e1fe6893499db527dc3eb76abdc8

Contents?: true

Size: 1.2 KB

Versions: 36

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8
class AddMagicLocales < ActiveRecord::Migration
  def up
    
    #
    ## Locales
    create_table :mgclang_locales do |t|
      # t.string      :name
      t.string      :natural_name
      t.string      :iso_code
      t.string      :locale_state,    default: "inactive"
      t.timestamps
    end
    
    add_index :mgclang_locales, :iso_code, unique: true
    
    MagicLocales::Locale.create_translation_table! :name => :string
    
    
    #
    ## (spoken) Languages
    create_table :mgclang_languages do |t|
      t.string        :level
      t.references    :owner,      polymorphic: true
      t.references    :locale
      t.timestamps
    end
    
    add_index :mgclang_languages, [:owner_type, :owner_id]
    add_index :mgclang_languages, :locale_id
    
    
    #
    ## seed default Locales
    load "#{ Rails.root }/db/seeds/locales.rb"
    
    
  end
  def down
    
    ## Addresses
    remove_index  :mgclang_locales, :iso_code
    drop_table    :mgclang_locales
    MagicAddresses::Address.drop_translation_table!
    
    
    remove_index  :mgclang_languages, :locale_id
    remove_index  :mgclang_languages, [:owner_type, :owner_id]
    drop_table    :mgclang_languages
    
  end
end

Version data entries

36 entries across 23 versions & 1 rubygems

Version Path
magic_locales-0.0.8 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.8 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.7 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.7 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.6 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.6 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.5 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.5 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.4 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.4 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.3 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.3 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.2 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.2 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.1 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.1 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb