Mercurial > hg > soundsoftware-site
comparison .svn/pristine/1d/1d1a40d68d66d098f38161f4b90f0e887e1b73d9.svn-base @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
1 class AddUniqueIndexOnTokensValue < ActiveRecord::Migration | |
2 def up | |
3 say_with_time "Adding unique index on tokens, this may take some time..." do | |
4 # Just in case | |
5 duplicates = Token.connection.select_values("SELECT value FROM #{Token.table_name} GROUP BY value HAVING COUNT(id) > 1") | |
6 Token.where(:value => duplicates).delete_all | |
7 | |
8 add_index :tokens, :value, :unique => true, :name => 'tokens_value' | |
9 end | |
10 end | |
11 | |
12 def down | |
13 remove_index :tokens, :name => 'tokens_value' | |
14 end | |
15 end |