rubocop: fix various style issues.

This commit is contained in:
evazion
2019-12-22 16:21:58 -06:00
parent 09f6a84660
commit 309821bf73
288 changed files with 912 additions and 962 deletions

View File

@@ -10,7 +10,7 @@ class CreateUserNameChangeRequests < ActiveRecord::Migration[4.2]
t.text :rejection_reason
t.timestamps
end
add_index :user_name_change_requests, :user_id
add_index :user_name_change_requests, :original_name
end

View File

@@ -5,7 +5,7 @@ class CreateKeyValues < ActiveRecord::Migration[4.2]
t.text :value
t.timestamps
end
add_index :key_values, :key, :unique => true
end
end

View File

@@ -5,7 +5,7 @@ class AddPixivIdToPosts < ActiveRecord::Migration[4.2]
execute "drop index index_posts_on_pixiv_id"
execute "create index index_posts_on_pixiv_id on posts (pixiv_id) where pixiv_id is not null"
end
def down
execute "set statement_timeout = 0"
remove_column :posts, :pixiv_id

View File

@@ -1,8 +1,8 @@
class ChangeTagSubscriptionTagQueryDelimiter < ActiveRecord::Migration[4.2]
def change
execute "set statement_timeout = 0"
#TagSubscription.find_each do |tag_subscription|
# TagSubscription.find_each do |tag_subscription|
# tag_subscription.update_column(:tag_query, tag_subscription.tag_query.scan(/\S+/).join("\n"))
#end
# end
end
end

View File

@@ -1,7 +1,7 @@
class RemoveUnusedIndexes < ActiveRecord::Migration[4.2]
def change
execute "set statement_timeout = 0"
#remove_index :posts, :source
# remove_index :posts, :source
remove_index :posts, :uploader_ip_addr
end
end

View File

@@ -1,5 +1,5 @@
class AddMinLevelToForumTopics < ActiveRecord::Migration[4.2]
def change
add_column :forum_topics, :min_level, :integer, :default => 0, :null => false
add_column :forum_topics, :min_level, :integer, :default => 0, :null => false
end
end

View File

@@ -1,8 +1,8 @@
class CreatePostApprovals < ActiveRecord::Migration[4.2]
def change
create_table :post_approvals do |t|
t.integer :user_id, null: false
t.integer :post_id, null: false
t.integer :user_id, null: false
t.integer :post_id, null: false
t.timestamps null: false
end

View File

@@ -1,5 +1,5 @@
class DropTransactionLogItems < ActiveRecord::Migration[4.2]
def up
drop_table :transaction_log_items
drop_table :transaction_log_items
end
end

View File

@@ -1,9 +1,9 @@
class DropPoolVersions < ActiveRecord::Migration[4.2]
def up
drop_table :pool_versions
drop_table :pool_versions
end
def down
raise NotImplementedError
raise NotImplementedError
end
end

View File

@@ -1,10 +1,10 @@
class CreateTokenBuckets < ActiveRecord::Migration[4.2]
def up
execute "create unlogged table token_buckets (user_id integer, last_touched_at timestamp not null, token_count real not null)"
add_index :token_buckets, :user_id, :unique => true
execute "create unlogged table token_buckets (user_id integer, last_touched_at timestamp not null, token_count real not null)"
add_index :token_buckets, :user_id, :unique => true
end
def down
raise NotImplementedError
raise NotImplementedError
end
end

View File

@@ -1,6 +1,6 @@
class AddTrigramIndexToUsers < ActiveRecord::Migration[4.2]
def change
execute "set statement_timeout = 0"
execute "set statement_timeout = 0"
execute "create index index_users_on_name_trgm on users using gin (lower(name) gin_trgm_ops)"
end
end

View File

@@ -1,8 +1,8 @@
class AddTagsToSavedSearches < ActiveRecord::Migration[4.2]
def change
execute "set statement_timeout = 0"
add_column :saved_searches, :labels, "text", array: true, null: false, default: []
add_index :saved_searches, :labels, using: :gin
rename_column :saved_searches, :tag_query, :query
execute "set statement_timeout = 0"
add_column :saved_searches, :labels, "text", array: true, null: false, default: []
add_index :saved_searches, :labels, using: :gin
rename_column :saved_searches, :tag_query, :query
end
end

View File

@@ -1,6 +1,6 @@
class DropPostVersions < ActiveRecord::Migration[4.2]
def change
execute "set statement_timeout = 0"
drop_table :post_versions
execute "set statement_timeout = 0"
drop_table :post_versions
end
end

View File

@@ -1,9 +1,9 @@
class AddForumPostIdToTagRequests < ActiveRecord::Migration[4.2]
def change
ApplicationRecord.without_timeout do
add_column :tag_aliases, :forum_post_id, :integer
add_column :tag_implications, :forum_post_id, :integer
add_column :bulk_update_requests, :forum_post_id, :integer
end
ApplicationRecord.without_timeout do
add_column :tag_aliases, :forum_post_id, :integer
add_column :tag_implications, :forum_post_id, :integer
add_column :bulk_update_requests, :forum_post_id, :integer
end
end
end

View File

@@ -1,5 +1,5 @@
class AddTitleToBulkUpdateRequests < ActiveRecord::Migration[4.2]
def change
add_column :bulk_update_requests, :title, :text
add_column :bulk_update_requests, :title, :text
end
end

View File

@@ -1,8 +1,8 @@
class AddUniqueNameConstraintToUsers < ActiveRecord::Migration[4.2]
def up
User.without_timeout do
remove_index :users, name: "index_users_on_name"
execute "create unique index index_users_on_name on users(lower(name))"
end
User.without_timeout do
remove_index :users, name: "index_users_on_name"
execute "create unique index index_users_on_name on users(lower(name))"
end
end
end

View File

@@ -1,5 +1,5 @@
class AddUpdatedAtIndexToPools < ActiveRecord::Migration[4.2]
def change
add_index :pools, :updated_at
add_index :pools, :updated_at
end
end

View File

@@ -1,10 +1,10 @@
class CreatePostReplacements < ActiveRecord::Migration[4.2]
def change
create_table :post_replacements do |t|
t.integer :post_id, null: false
t.integer :creator_id, null: false
t.text :original_url, null: false
t.text :replacement_url, null: false
t.integer :post_id, null: false
t.integer :creator_id, null: false
t.text :original_url, null: false
t.text :replacement_url, null: false
t.timestamps null: false
end

View File

@@ -1,5 +1,5 @@
class AddSortIndexesToForumTopics < ActiveRecord::Migration[4.2]
def change
add_index :forum_topics, [:is_sticky, :updated_at]
add_index :forum_topics, [:is_sticky, :updated_at]
end
end

View File

@@ -6,7 +6,7 @@ class FixLastNotedAtIndexOnPosts < ActiveRecord::Migration[4.2]
remove_index :posts, column: :last_noted_at
add_index :posts, :last_noted_at, order: "DESC NULLS LAST"
execute "analyze posts"
end
end

View File

@@ -1,7 +1,7 @@
class AddIsSpamToDmails < ActiveRecord::Migration[4.2]
def change
Dmail.without_timeout do
add_column :dmails, :is_spam, :boolean, default: false
end
Dmail.without_timeout do
add_column :dmails, :is_spam, :boolean, default: false
end
end
end

View File

@@ -1,13 +1,13 @@
class AddTrigramIndexToTags < ActiveRecord::Migration[4.2]
def up
Tag.without_timeout do
execute "create index index_tags_on_name_trgm on tags using gin (name gin_trgm_ops)"
end
Tag.without_timeout do
execute "create index index_tags_on_name_trgm on tags using gin (name gin_trgm_ops)"
end
end
def down
Tag.without_timeout do
execute "drop index index_tags_on_name_trgm"
end
Tag.without_timeout do
execute "drop index index_tags_on_name_trgm"
end
end
end

View File

@@ -1,7 +1,7 @@
class AddTrigramIndexToArtistUrls < ActiveRecord::Migration[5.2]
def change
execute "set statement_timeout = 0"
change_table :artist_urls do |t|
t.remove_index column: :url, name: :index_artist_urls_on_url
t.remove_index column: :url, name: :index_artist_urls_on_url_pattern, opclass: :text_pattern_ops