diff --git a/db/migrate/20100409194926_add_missing_indices.rb b/db/migrate/20100409194926_add_missing_indices.rb index 080908d..47bfc18 100644 --- a/db/migrate/20100409194926_add_missing_indices.rb +++ b/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 diff --git a/generators/tolk_migration/templates/migrate/create_tolk_tables.rb b/generators/tolk_migration/templates/migrate/create_tolk_tables.rb index 7376973..b0cbed8 100644 --- a/generators/tolk_migration/templates/migrate/create_tolk_tables.rb +++ b/generators/tolk_migration/templates/migrate/create_tolk_tables.rb @@ -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 @@ -25,7 +23,7 @@ def self.up t.datetime :created_at t.datetime :updated_at end - + add_index :tolk_translations, [:phrase_id, :locale_id], :unique => true end @@ -33,6 +31,7 @@ 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