Update migrations to be compatible with Rails 4

This commit is contained in:
Stephan Kaag 2013-07-03 21:07:13 +02:00
parent ba0bd934ba
commit 93cc6f63ae
3 changed files with 3 additions and 3 deletions

View file

@ -3,7 +3,7 @@ class AddDisplayUsernameToUsers < ActiveRecord::Migration
add_column :users, :display_username, :string add_column :users, :display_username, :string
execute "UPDATE users SET display_username = username" execute "UPDATE users SET display_username = username"
execute "UPDATE users SET username = REPLACE(username, ' ', '')" execute "UPDATE users SET username = REPLACE(username, ' ', '')"
add_index :users, :username, :unique add_index :users, :username, unique: true
end end
def down def down

View file

@ -8,6 +8,6 @@ class CreateForumThreadLinkClicks < ActiveRecord::Migration
end end
add_column :forum_thread_links, :clicks, :integer, default: 0, null: false add_column :forum_thread_links, :clicks, :integer, default: 0, null: false
add_index :forum_thread_link_clicks, :forum_thread_link_id, as: :by_link add_index :forum_thread_link_clicks, :forum_thread_link_id, name: :by_link
end end
end end

View file

@ -8,6 +8,6 @@ class AddUniqueIndexToForumThreadLinks < ActiveRecord::Migration
AND ftl2.id < forum_thread_links.id" AND ftl2.id < forum_thread_links.id"
# Add the unique index # Add the unique index
add_index :forum_thread_links, [:forum_thread_id, :post_id, :url], unique: true, as: 'unique_post_links' add_index :forum_thread_links, [:forum_thread_id, :post_id, :url], unique: true, name: 'unique_post_links'
end end
end end