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.21 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.20 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.19 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.18 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.17 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.17.beta2 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.17.beta1 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.16 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.15 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.14 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.13 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.13 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.12 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.12 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.11 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.11 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.10 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb
magic_locales-0.0.10 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.9 lib/generators/magic_locales/templates/magic_logales_migration.rb
magic_locales-0.0.9 spec/dummy/db/migrate/20150327111103_add_magic_locales.rb