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



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

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(%i[localizable_id localizable_type name locale],
            name: "index_localizations_on_locale")
    t.index %i[localizable_id localizable_type]
  end
end