Class: CreateReleafTranslations

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/releaf/templates/migrations/create_releaf_translations.rb

Instance Method Summary collapse

Instance Method Details

#changeObject


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/releaf/templates/migrations/create_releaf_translations.rb', line 2

def change
  create_table :releaf_i18n_entries do |t|
    t.string :key, null: false
    t.timestamps null: false
  end
  add_index :releaf_i18n_entries, :key

  create_table :releaf_i18n_entry_translations do |t|
    t.integer :i18n_entry_id, null: false
    t.string :locale, null: false, limit: 5
    t.text :text
    t.timestamps null: false
  end
  add_index :releaf_i18n_entry_translations, :locale
  add_index :releaf_i18n_entry_translations, :i18n_entry_id
  add_index :releaf_i18n_entry_translations, [:locale, :i18n_entry_id], unique: true,
    name: :index_releaf_i18n_entry_translations_on_locale_i18n_entry_id
end