You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
591 B
15 lines
591 B
class AddNameReversedToDomains < ActiveRecord::Migration |
|
def up |
|
# used for "%" search indexing in an ancestry fashion (materialized path pattern) |
|
# http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html |
|
add_column :domains, :name_reversed, :string, :limit => 255 |
|
execute "UPDATE domains SET name_reversed = REVERSE(name)" |
|
change_column :domains, :name_reversed, :string, :limit => 255, :null => false |
|
add_index :domains, :name_reversed |
|
end |
|
|
|
def down |
|
remove_index :domains, :column => :name_reversed |
|
remove_column :domains, :name_reversed |
|
end |
|
end
|
|
|