Merge pull request #2052 from gladiac/fix_mysql
db: Fixed the migration of the database.
This commit is contained in:
commit
ce5c1ef003
3 changed files with 18 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
14
db/migrate/20110926120220_fix_indexes_to_serivces.rb
Normal file
14
db/migrate/20110926120220_fix_indexes_to_serivces.rb
Normal 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
|
||||
Loading…
Reference in a new issue