Kill trailing whitespace in ruby files

This commit is contained in:
小太
2013-03-19 23:10:10 +11:00
parent c107f96cec
commit cba839ba76
319 changed files with 2710 additions and 2710 deletions

View File

@@ -2,7 +2,7 @@ class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.timestamps
t.column :name, :string, :null => false
t.column :password_hash, :string, :null => false
t.column :email, :string
@@ -11,7 +11,7 @@ class CreateUsers < ActiveRecord::Migration
t.column :is_banned, :boolean, :null => false, :default => false
t.column :level, :integer, :null => false, :default => 0
t.column :base_upload_limit, :integer, :null => false, :default => 10
# Cached data
t.column :last_logged_in_at, :datetime
t.column :last_forum_read_at, :datetime
@@ -21,7 +21,7 @@ class CreateUsers < ActiveRecord::Migration
t.column :post_update_count, :integer, :null => false, :default => 0
t.column :note_update_count, :integer, :null => false, :default => 0
t.column :favorite_count, :integer, :null => false, :default => 0
# Profile settings
t.column :receive_email_notifications, :boolean, :null => false, :default => false
t.column :comment_threshold, :integer, :null => false, :default => -1
@@ -31,7 +31,7 @@ class CreateUsers < ActiveRecord::Migration
t.column :blacklisted_tags, :text
t.column :time_zone, :string, :null => false, :default => "Eastern Time (US & Canada)"
end
execute "CREATE UNIQUE INDEX index_users_on_name ON users ((lower(name)))"
add_index :users, :email, :unique => true
end

View File

@@ -2,7 +2,7 @@ class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
t.timestamps
t.column :up_score, :integer, :null => false, :default => 0
t.column :down_score, :integer, :null => false, :default => 0
t.column :score, :integer, :null => false, :default => 0
@@ -21,7 +21,7 @@ class CreatePosts < ActiveRecord::Migration
# Uploader
t.column :uploader_id, :integer, :null => false
t.column :uploader_ip_addr, "inet", :null => false
# Approver
t.column :approver_id, :integer
@@ -50,12 +50,12 @@ class CreatePosts < ActiveRecord::Migration
t.column :file_size, :integer, :null => false
t.column :image_width, :integer, :null => false
t.column :image_height, :integer, :null => false
# Parent
t.column :parent_id, :integer
t.column :has_children, :boolean, :null => false, :default => false
end
add_index :posts, :md5, :unique => true
add_index :posts, :created_at
add_index :posts, :last_commented_at
@@ -102,7 +102,7 @@ class CreatePosts < ActiveRecord::Migration
HEADLINE = pg_catalog.prsd_headline,
LEXTYPES = testprs_lextype
)"
execute "CREATE INDEX index_posts_on_tags_index ON posts USING gin (tag_index)"
execute "CREATE TEXT SEARCH CONFIGURATION public.danbooru (PARSER = public.testparser)"
execute "ALTER TEXT SEARCH CONFIGURATION public.danbooru ADD MAPPING FOR WORD WITH SIMPLE"

View File

@@ -8,7 +8,7 @@ class CreateTags < ActiveRecord::Migration
t.column :related_tags_updated_at, :datetime
t.timestamps
end
add_index :tags, :name, :unique => true
execute "create index index_tags_on_name_pattern on tags (name text_pattern_ops)"
end

View File

@@ -2,7 +2,7 @@ class CreatePostVersions < ActiveRecord::Migration
def self.up
create_table :post_versions do |t|
t.timestamps
t.column :post_id, :integer, :null => false
t.column :tags, :text, :null => false, :default => ""
t.column :rating, :char
@@ -11,7 +11,7 @@ class CreatePostVersions < ActiveRecord::Migration
t.column :updater_id, :integer, :null => false
t.column :updater_ip_addr, "inet", :null => false
end
add_index :post_versions, :post_id
add_index :post_versions, :updater_id
add_index :post_versions, :updater_ip_addr

View File

@@ -14,7 +14,7 @@ class CreateUploads < ActiveRecord::Migration
t.column :md5_confirmation, :string
t.timestamps
end
add_index :uploads, :uploader_id
add_index :uploads, :uploader_ip_addr
end

View File

@@ -10,7 +10,7 @@ class CreatePools < ActiveRecord::Migration
t.column :is_deleted, :boolean, :null => false, :default => false
t.timestamps
end
add_index :pools, :name
add_index :pools, :creator_id
end

View File

@@ -1,6 +1,6 @@
class CreateFavorites < ActiveRecord::Migration
TABLE_COUNT = 100
def self.up
# this is a dummy table and should not be used
create_table "favorites" do |t|
@@ -14,20 +14,20 @@ class CreateFavorites < ActiveRecord::Migration
check (user_id % 100 = #{i})
) inherits (favorites)
EOS
add_index "favorites_#{i}", :user_id
add_index "favorites_#{i}", :post_id
end
fragment = []
1.upto(TABLE_COUNT - 1) do |i|
fragment << <<-EOS
elsif (NEW.user_id % 100 = #{i}) then
insert into favorites_#{i} values (NEW.*);
EOS
end
execute <<-EOS
create or replace function favorites_insert_trigger()
returns trigger as $$
@@ -41,7 +41,7 @@ class CreateFavorites < ActiveRecord::Migration
$$
language plpgsql
EOS
execute <<-EOS
create trigger insert_favorites_trigger
before insert on favorites
@@ -51,7 +51,7 @@ class CreateFavorites < ActiveRecord::Migration
def self.down
drop_table "favorites"
0.upto(TABLE_COUNT - 1) do |i|
drop_table "favorites_#{i}"
end

View File

@@ -9,7 +9,7 @@ class CreateTagAliases < ActiveRecord::Migration
t.column :status, :text, :null => false, :default => "pending"
t.timestamps
end
add_index :tag_aliases, :antecedent_name
add_index :tag_aliases, :consequent_name
end

View File

@@ -10,7 +10,7 @@ class CreateTagImplications < ActiveRecord::Migration
t.column :status, :text, :null => false, :default => "pending"
t.timestamps
end
add_index :tag_implications, :antecedent_name
add_index :tag_implications, :consequent_name
end

View File

@@ -9,7 +9,7 @@ class CreateComments < ActiveRecord::Migration
t.column :score, :integer, :null => false, :default => 0
t.timestamps
end
add_index :comments, :post_id
execute "CREATE INDEX index_comments_on_body_index ON comments USING GIN (body_index)"
execute "CREATE TRIGGER trigger_comments_on_update BEFORE INSERT OR UPDATE ON comments FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'pg_catalog.english', 'body')"

View File

@@ -6,7 +6,7 @@ class CreateCommentVotes < ActiveRecord::Migration
t.column :score, :integer, :null => false
t.timestamps
end
add_index :comment_votes, :comment_id
add_index :comment_votes, :user_id
add_index :comment_votes, :created_at

View File

@@ -12,7 +12,7 @@ class CreateArtistVersions < ActiveRecord::Migration
t.column :is_banned, :boolean, :null => false, :default => false
t.timestamps
end
add_index :artist_versions, :artist_id
add_index :artist_versions, :name
add_index :artist_versions, :updater_id

View File

@@ -6,11 +6,11 @@ class CreateArtistUrls < ActiveRecord::Migration
t.column :normalized_url, :text, :null => false
t.timestamps
end
add_index :artist_urls, :artist_id
add_index :artist_urls, :normalized_url
add_index :artist_urls, :url
execute "create index index_artist_urls_on_url_pattern on artist_urls (url text_pattern_ops)"
execute "create index index_artist_urls_on_normalized_url_pattern on artist_urls (normalized_url text_pattern_ops)"
end

View File

@@ -8,7 +8,7 @@ class CreateWikiPages < ActiveRecord::Migration
t.column :is_locked, :boolean, :null => false, :default => false
t.timestamps
end
add_index :wiki_pages, :title, :unique => true
execute "CREATE INDEX index_wiki_pages_on_body_index_index ON wiki_pages USING GIN (body_index)"
execute "CREATE TRIGGER trigger_wiki_pages_on_update BEFORE INSERT OR UPDATE ON wiki_pages FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'public.danbooru', 'body', 'title')"

View File

@@ -9,7 +9,7 @@ class CreateWikiPageVersions < ActiveRecord::Migration
t.column :is_locked, :boolean, :null => false
t.timestamps
end
add_index :wiki_page_versions, :wiki_page_id
end

View File

@@ -6,7 +6,7 @@ class CreatePostVotes < ActiveRecord::Migration
t.column :score, :integer, :null => false
t.timestamps
end
add_index :post_votes, :post_id
add_index :post_votes, :user_id
end

View File

@@ -11,7 +11,7 @@ class CreateAdvertisements < ActiveRecord::Migration
t.column :is_work_safe, :boolean, :null => false, :default => false
t.timestamps
end
add_index :advertisements, :ad_type
end

View File

@@ -5,7 +5,7 @@ class CreateAdvertisementHits < ActiveRecord::Migration
t.column :ip_addr, "inet", :null => false
t.timestamps
end
add_index :advertisement_hits, :advertisement_id
add_index :advertisement_hits, :created_at
end

View File

@@ -7,7 +7,7 @@ class CreateBans < ActiveRecord::Migration
t.column :expires_at, :datetime, :null => false
t.timestamps
end
add_index :bans, :user_id
add_index :bans, :expires_at
add_index :bans, :banner_id

View File

@@ -7,7 +7,7 @@ class CreateUserFeedback < ActiveRecord::Migration
t.column :body, :text, :null => false
t.timestamps
end
add_index :user_feedback, :user_id
add_index :user_feedback, :creator_id
end

View File

@@ -11,9 +11,9 @@ class CreateDmails < ActiveRecord::Migration
t.column :is_deleted, :boolean, :null => false, :default => false
t.timestamps
end
add_index :dmails, :owner_id
execute "CREATE INDEX index_dmails_on_message_index ON dmails USING GIN (message_index)"
execute "CREATE TRIGGER trigger_dmails_on_update BEFORE INSERT OR UPDATE ON dmails FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('message_index', 'pg_catalog.english', 'title', 'body')"
end

View File

@@ -11,7 +11,7 @@ class CreateForumTopics < ActiveRecord::Migration
t.column :text_index, "tsvector", :null => false
t.timestamps
end
add_index :forum_topics, :creator_id
execute "CREATE INDEX index_forum_topics_on_text_index ON forum_topics USING GIN (text_index)"

View File

@@ -5,7 +5,7 @@ class CreatePostDisapprovals < ActiveRecord::Migration
t.column :post_id, :integer, :null => false
t.timestamps
end
add_index :post_disapprovals, :user_id
add_index :post_disapprovals, :post_id
end

View File

@@ -12,7 +12,7 @@ class CreateNotes < ActiveRecord::Migration
t.column :body_index, "tsvector", :null => false
t.timestamps
end
add_index :notes, :creator_id
add_index :notes, :post_id
execute "CREATE INDEX index_notes_on_body_index ON notes USING GIN (body_index)"

View File

@@ -13,7 +13,7 @@ class CreateNoteVersions < ActiveRecord::Migration
t.column :body, :text, :null => false
t.timestamps
end
add_index :note_versions, :note_id
add_index :note_versions, :post_id
add_index :note_versions, :updater_id

View File

@@ -10,7 +10,7 @@ class CreateTagSubscriptions < ActiveRecord::Migration
t.column :is_opted_in, :boolean, :null => false, :default => false
t.timestamps
end
add_index :tag_subscriptions, :creator_id
add_index :tag_subscriptions, :name
end

View File

@@ -6,7 +6,7 @@ class CreateJanitorTrials < ActiveRecord::Migration
t.column :original_level, :integer, :null => false
t.timestamps
end
add_index :janitor_trials, :user_id
end

View File

@@ -6,7 +6,7 @@ class CreateIpBans < ActiveRecord::Migration
t.column :reason, :text, :null => false
t.timestamps
end
add_index :ip_bans, :ip_addr, :unique => true
end

View File

@@ -11,7 +11,7 @@ class CreateDelayedJobs < ActiveRecord::Migration
table.string :locked_by # Who is working on this object (if locked)
table.timestamps
end
add_index :delayed_jobs, :run_at
end

View File

@@ -8,7 +8,7 @@ class CreatePostFlags < ActiveRecord::Migration
t.column :is_resolved, :boolean, :null => false, :default => false
t.timestamps
end
add_index :post_flags, :post_id
add_index :post_flags, :creator_id
add_index :post_flags, :creator_ip_addr

View File

@@ -7,7 +7,7 @@ class CreatePostAppeals < ActiveRecord::Migration
t.column :reason, :text
t.timestamps
end
add_index :post_appeals, :post_id
add_index :post_appeals, :creator_id
add_index :post_appeals, :creator_ip_addr

View File

@@ -7,7 +7,7 @@ class CreatePoolVersions < ActiveRecord::Migration
t.column :updater_ip_addr, "inet", :null => false
t.timestamps
end
add_index :pool_versions, :pool_id
add_index :pool_versions, :updater_id
add_index :pool_versions, :updater_ip_addr

View File

@@ -6,7 +6,7 @@ class CreateNewsUpdates < ActiveRecord::Migration
t.column :updater_id, :integer, :null => false
t.timestamps
end
add_index :news_updates, :created_at
end
end

View File

@@ -1,7 +1,7 @@
class AddBcryptFieldsToUsers < ActiveRecord::Migration
def change
execute "set statement_timeout = 0"
add_column :users, :bcrypt_password_hash, :text
end
end

View File

@@ -8,7 +8,7 @@ if User.count == 0
:password => "password1",
:password_confirmation => "password1"
)
0.upto(100) do |i|
User.create(
:name => i.to_s * 5,
@@ -32,7 +32,7 @@ if Upload.count == 0
height = rand(2000) + 100
url = "http://ipsumimage.appspot.com/#{width}x#{height}"
tags = (i * i * i).to_s.scan(/./).uniq.join(" ")
Upload.create(:source => url, :content_type => "image/gif", :rating => "q", :tag_string => tags, :server => Socket.gethostname)
end
else
@@ -64,7 +64,7 @@ if Note.count == 0
Post.all.each do |post|
rand(10).times do
note = Note.create(:post_id => post.id, :x => 0, :y => 0, :width => 100, :height => 100, :body => Time.now.to_f.to_s)
rand(30).times do |i|
note.update_attributes(:body => (i * i).to_s)
end
@@ -85,7 +85,7 @@ end
if TagAlias.count == 0
puts "Creating tag aliases"
100.upto(199) do |i|
TagAlias.create(:antecedent_name => i.to_s, :consequent_name => (i * 100).to_s)
end
@@ -105,7 +105,7 @@ end
if Pool.count == 0
puts "Creating pools"
1.upto(20) do |i|
pool = Pool.create(:name => i.to_s)
rand(33).times do |j|
@@ -122,16 +122,16 @@ if Favorite.count == 0
post.add_favorite!(user)
post.add_favorite!(CurrentUser.user)
end
else
else
puts "Skipping favorites"
end
if ForumTopic.count == 0
puts "Creating forum posts"
100.times do |i|
topic = ForumTopic.create(:title => Time.now.to_f.to_s)
rand(100).times do |j|
post = ForumPost.create(:topic_id => topic.id, :body => Time.now.to_f.to_s)
end