Skip to content

Commit

Permalink
Do not index text translation columns on value
Browse files Browse the repository at this point in the history
MySQL doesn't like this index since the text column is huge so hard to
index without a limit. Probably better to let the developer add this
index themselves.

Closes #8.
  • Loading branch information
shioyama committed Mar 16, 2017
1 parent 19f89b3 commit 574172d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ def change
end
add_index :mobility_text_translations, [:translatable_id, :translatable_type, :locale, :key], unique: true, name: :index_mobility_text_translations_on_keys
add_index :mobility_text_translations, [:translatable_id, :translatable_type, :key], name: :index_mobility_text_translations_on_translatable_attribute
add_index :mobility_text_translations, [:translatable_type, :key, :value, :locale], name: :index_mobility_text_translations_on_query_keys
end
end
1 change: 0 additions & 1 deletion spec/active_record/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def up
end
add_index :mobility_text_translations, [:translatable_id, :translatable_type, :locale, :key], unique: true, name: :index_mobility_text_translations_on_keys
add_index :mobility_text_translations, [:translatable_id, :translatable_type, :key], name: :index_mobility_text_translations_on_translatable_attribute
add_index :mobility_text_translations, [:translatable_type, :key, :value, :locale], name: :index_mobility_text_translations_on_query_keys

create_table "comments" do |t|
t.text :content_en
Expand Down
1 change: 0 additions & 1 deletion spec/sequel/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def migrate(*)
String :translatable_type, null: false
index [:translatable_id, :translatable_type, :locale, :key], unique: true, name: :index_mobility_text_translations_on_keys
index [:translatable_id, :translatable_type, :key], name: :index_mobility_text_translations_on_translatable_attribute
index [:translatable_type, :key, :value, :locale], name: :index_mobility_text_translations_on_query_keys
end

DB.create_table? :mobility_string_translations do
Expand Down

0 comments on commit 574172d

Please sign in to comment.