Class: CreateLocalizations

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/rails/generators/localizable_model/migration/templates/create_localizations.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/rails/generators/localizable_model/migration/templates/create_localizations.rb', line 2

def change
  create_table :localizations do |t|
    t.references :localizable, polymorphic: true
    t.string :name
    t.string :locale
    t.text :value, limit: 16_777_215
    t.timestamps null: false
    t.index([:localizable_id, :localizable_type, :name, :locale],
            name: "index_localizations_on_locale")
    t.index [:localizable_id, :localizable_type]
  end
end