Navigation Menu

Skip to content

Commit

Permalink
Dont add index for a TEXT column
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed May 8, 2010
1 parent 3b87a73 commit e0c7296
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
7 changes: 0 additions & 7 deletions db/migrate/20100409194926_add_missing_indices.rb
@@ -1,13 +1,6 @@
class AddMissingIndices < ActiveRecord::Migration
def self.up
add_index :tolk_locales, :name, :unique => true
if connection.class.name == "ActiveRecord::ConnectionAdapters::MysqlAdapter"
# Manually create an index on the first 512 bytes because MySQL can’t
# build an unbound index on TEXT/BLOB columns.
execute "CREATE INDEX `index_tolk_phrases_on_key` ON `tolk_phrases` (`key`(512))"
else
add_index :tolk_phrases, :key, :unique => true
end
add_index :tolk_translations, [:phrase_id, :locale_id], :unique => true
end

Expand Down
Expand Up @@ -13,8 +13,6 @@ def self.up
t.datetime :created_at
t.datetime :updated_at
end

add_index :tolk_phrases, :key, :unique => true

create_table :tolk_translations do |t|
t.integer :phrase_id
Expand All @@ -25,14 +23,15 @@ def self.up
t.datetime :created_at
t.datetime :updated_at
end

add_index :tolk_translations, [:phrase_id, :locale_id], :unique => true
end

def self.down
remove_index :tolk_translations, :column => [:phrase_id, :locale_id]
remove_index :tolk_phrases, :column => :key
remove_index :tolk_locales, :column => :name

drop_table :tolk_translations
drop_table :tolk_phrases
drop_table :tolk_locales
Expand Down

0 comments on commit e0c7296

Please sign in to comment.