Merge pull request #2052 from gladiac/fix_mysql

db: Fixed the migration of the database.
This commit is contained in:
Daniel Grippi 2011-09-26 09:37:30 -07:00
commit ce5c1ef003
3 changed files with 18 additions and 2 deletions

View file

@ -133,10 +133,10 @@ class CreateSchema < ActiveRecord::Migration
add_index :requests, [:sender_id, :recipient_id], :unique => true
create_table :services do |t|
t.string :type
t.string :type, :limit => 127
t.integer :user_id
t.string :provider
t.string :uid
t.string :uid, :limit => 127
t.string :access_token
t.string :access_secret
t.string :nickname

View file

@ -1,5 +1,7 @@
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

View file

@ -0,0 +1,14 @@
class FixIndexesToSerivces < ActiveRecord::Migration
# This alters the tables to avoid a mysql bug
# See http://bugs.joindiaspora.com/issues/835
def self.up
remove_index :services, :column => [:type, :uid]
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