The limit down to 127 is needed cause of a long time bug in mysql. The error message looks like this when creating an index. Mysql2::Error: Specified key was too long; max key length is 1000 bytes So with utf8 (3 bytes for one char) you exceed this with two varchar(255). See http://bugs.mysql.com/bug.php?id=4541 guru meditation Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
11 lines
311 B
Ruby
11 lines
311 B
Ruby
class AddIndexesToSerivces < ActiveRecord::Migration
|
|
def self.up
|
|
change_column(:services, :type, :string, :limit => 127)
|
|
change_column(:services, :uid, :string, :limit => 127)
|
|
add_index :services, [:type, :uid]
|
|
end
|
|
|
|
def self.down
|
|
remove_index :services, :column => [:type, :uid]
|
|
end
|
|
end
|