Convert a lot of :a => b to a: b and bring peace to the world

This commit is contained in:
Karan Misra
2013-03-23 20:32:59 +05:30
parent cb9106c3a7
commit 5dfb04e4b3
62 changed files with 171 additions and 171 deletions

View File

@@ -1,7 +1,7 @@
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :username, :limit => 20, null: false
t.string :username, limit: 20, null: false
t.string :avatar_url, null: false
t.timestamps
end

View File

@@ -4,6 +4,6 @@ class RemoveLastPostId < ActiveRecord::Migration
end
def down
add_column :forum_threads, :last_post_id, :integer, :default => 0
add_column :forum_threads, :last_post_id, :integer, default: 0
end
end

View File

@@ -1,8 +1,8 @@
class CreateVestalVersions < ActiveRecord::Migration
def self.up
create_table :versions do |t|
t.belongs_to :versioned, :polymorphic => true
t.belongs_to :user, :polymorphic => true
t.belongs_to :versioned, polymorphic: true
t.belongs_to :user, polymorphic: true
t.string :user_name
t.text :modifications
t.integer :number

View File

@@ -7,7 +7,7 @@ class CreateReadPosts < ActiveRecord::Migration
t.column :seen, :integer, null: false
end
add_index :read_posts, [:forum_thread_id, :user_id, :page], :unique => true
add_index :read_posts, [:forum_thread_id, :user_id, :page], unique: true
end
def down

View File

@@ -1,9 +1,9 @@
class CreateSiteSettings < ActiveRecord::Migration
def change
create_table :site_settings do |t|
t.string :name, :null => false
t.text :description, :null => false
t.integer :data_type, :null => false
t.string :name, null: false
t.text :description, null: false
t.integer :data_type, null: false
t.text :value
t.timestamps

View File

@@ -2,7 +2,7 @@ class AddUsernameLowerToUsers < ActiveRecord::Migration
def up
add_column :users, :username_lower, :string, limit: 20
execute "update users set username_lower = lower(username)"
add_index :users, [:username_lower], :unique => true
add_index :users, [:username_lower], unique: true
change_column :users, :username_lower, :string, limit: 20, null:false
end
def down

View File

@@ -1,9 +1,9 @@
class AddNewPasswordNewSaltEmailTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :new_salt, :string, :limit => 32
add_column :users, :new_password_hash, :string, :limit => 64
add_column :users, :new_salt, :string, limit: 32
add_column :users, :new_password_hash, :string, limit: 64
# email token is more flexible, can be used for both intial activation AND password change confirmation
add_column :users, :email_token, :string, :limit => 32
add_column :users, :email_token, :string, limit: 32
remove_column :users, :activation_key
end
end

View File

@@ -9,8 +9,8 @@ class CreateActions < ActiveRecord::Migration
# but this table is wider and is intended for non-notifying actions as well
t.integer :action_type, :null => false
t.integer :user_id, :null => false
t.integer :action_type, null: false
t.integer :user_id, null: false
t.integer :target_forum_thread_id
t.integer :target_post_id
t.integer :target_user_id

View File

@@ -1,17 +1,17 @@
class RemoveSiteId < ActiveRecord::Migration
def up
drop_table 'sites'
remove_index 'incoming_links', :name => "incoming_index"
add_index "incoming_links", ["forum_thread_id", "post_number"], :name => "incoming_index"
remove_index 'incoming_links', name: "incoming_index"
add_index "incoming_links", ["forum_thread_id", "post_number"], name: "incoming_index"
remove_column 'incoming_links', 'site_id'
remove_index 'users', :name => 'index_users_on_site_id'
remove_index 'users', name: 'index_users_on_site_id'
remove_column 'users', 'site_id'
remove_index 'expression_types', :name => 'index_expression_types_on_site_id_and_expression_index'
remove_index 'expression_types', :name => 'index_expression_types_on_site_id_and_name'
remove_index 'expression_types', name: 'index_expression_types_on_site_id_and_expression_index'
remove_index 'expression_types', name: 'index_expression_types_on_site_id_and_name'
remove_column 'expression_types','site_id'
add_index "expression_types", ["expression_index"], :unique => true
add_index "expression_types", ["name"], :unique => true
add_index "expression_types", ["expression_index"], unique: true
add_index "expression_types", ["name"], unique: true
drop_table 'forums'
end

View File

@@ -14,7 +14,7 @@ where pp.id = c.id and pp.post_number <> c.real_number"
remove_index "posts", ["forum_thread_id","post_number"]
# this needs to be unique if it is not we can not use post_number to identify a post
add_index "posts", ["forum_thread_id","post_number"], :unique => true
add_index "posts", ["forum_thread_id","post_number"], unique: true
end

View File

@@ -6,6 +6,6 @@ class RemoveIndexForNow < ActiveRecord::Migration
def down
remove_index "posts", ["forum_thread_id","post_number"]
add_index "posts", ["forum_thread_id","post_number"], :unique => true
add_index "posts", ["forum_thread_id","post_number"], unique: true
end
end

View File

@@ -1,13 +1,13 @@
class AddTwitterUserInfo < ActiveRecord::Migration
def change
create_table :twitter_user_infos do |t|
t.integer :user_id, :null => false
t.string :screen_name, :null => false
t.integer :twitter_user_id, :null => false
t.integer :user_id, null: false
t.string :screen_name, null: false
t.integer :twitter_user_id, null: false
t.timestamps
end
add_index :twitter_user_infos, [:twitter_user_id], :unique => true
add_index :twitter_user_infos, [:user_id], :unique => true
add_index :twitter_user_infos, [:twitter_user_id], unique: true
add_index :twitter_user_infos, [:user_id], unique: true
end
end

View File

@@ -1,12 +1,12 @@
class CreateTopicAllowedUsers < ActiveRecord::Migration
def change
create_table :topic_allowed_users do |t|
t.integer :user_id, :null => false
t.integer :topic_id, :null => false
t.integer :user_id, null: false
t.integer :topic_id, null: false
t.timestamps
end
add_index :topic_allowed_users, [:topic_id, :user_id], :unique => true
add_index :topic_allowed_users, [:user_id, :topic_id], :unique => true
add_index :topic_allowed_users, [:topic_id, :user_id], unique: true
add_index :topic_allowed_users, [:user_id, :topic_id], unique: true
end
end

View File

@@ -1,7 +1,7 @@
class AddMutedAtToTopicUser < ActiveRecord::Migration
def change
add_column :topic_users, :muted_at, :datetime
change_column :topic_users, :last_read_post_number, :integer, :null => true
change_column :topic_users, :last_read_post_number, :integer, null: true
change_column_default :topic_users, :last_read_post_number, nil
end
end

View File

@@ -21,7 +21,7 @@ from
where calc <> p.post_number and X.id = p.id')
remove_index :posts, :forum_thread_id_and_post_number
add_index :posts, [:topic_id, :post_number], :unique => true
add_index :posts, [:topic_id, :post_number], unique: true
end
def down

View File

@@ -1,6 +1,6 @@
class AlterFacebookUserId < ActiveRecord::Migration
def up
change_column :facebook_user_infos, :facebook_user_id, :integer, :limit => 8, null: false
change_column :facebook_user_infos, :facebook_user_id, :integer, limit: 8, null: false
end
def down

View File

@@ -1,13 +1,13 @@
class AddGithubUserInfo < ActiveRecord::Migration
def change
create_table :github_user_infos do |t|
t.integer :user_id, :null => false
t.string :screen_name, :null => false
t.integer :github_user_id, :null => false
t.timestamps
create_table :github_user_infos do |t|
t.integer :user_id, null: false
t.string :screen_name, null: false
t.integer :github_user_id, null: false
t.timestamps
end
add_index :github_user_infos, [:github_user_id], :unique => true
add_index :github_user_infos, [:user_id], :unique => true
add_index :github_user_infos, [:github_user_id], unique: true
add_index :github_user_infos, [:user_id], unique: true
end
end
end