fixed tag and pending post tests, added category multiget helper to tag, post/unapproval/post version in progress still

This commit is contained in:
albert
2010-02-10 16:12:30 -05:00
parent ef8be1a500
commit e6888ea1dd
19 changed files with 1077 additions and 319 deletions

View File

@@ -23,6 +23,7 @@ class CreateUsers < ActiveRecord::Migration
t.column :receive_email_notifications, :boolean, :null => false, :default => false
t.column :comment_threshold, :integer, :null => false, :default => -1
t.column :always_resize_images, :boolean, :null => false, :default => false
t.column :default_image_size, :string, :null => false, :default => "medium"
t.column :favorite_tags, :text
t.column :blacklisted_tags, :text
end

View File

@@ -7,25 +7,34 @@ class CreatePosts < ActiveRecord::Migration
t.column :source, :string
t.column :md5, :string, :null => false
t.column :rating, :character, :null => false, :default => 'q'
# Statuses
t.column :is_note_locked, :boolean, :null => false, :default => false
t.column :is_rating_locked, :boolean, :null => false, :default => false
t.column :is_pending, :boolean, :null => false, :default => false
t.column :is_flagged, :boolean, :null => false, :default => false
t.column :is_deleted, :boolean, :null => false, :default => false
t.column :approver_id, :integer
t.column :change_seq, :integer, :default => "nextval('post_change_seq'::regclass)"
# Uploader
t.column :uploader_id, :integer, :null => false
t.column :uploader_string, :string, :null => false
t.column :uploader_ip_addr, "inet", :null => false
# Approver
t.column :approver_string, :string, :null => false, :default => ""
# Favorites
t.column :fav_string, :text, :null => false, :default => ""
# Pools
t.column :pool_string, :text, :null => false, :default => ""
# Cached
t.column :fav_count, :integer
t.column :view_count, :integer, :null => false, :default => 0
t.column :last_noted_at, :datetime
t.column :last_commented_at, :datetime
# Tags
t.column :tag_string, :text, :null => false
t.column :tag_string, :text, :null => false, :default => ""
t.column :tag_index, "tsvector"
t.column :tag_count, :integer, :null => false, :default => 0
t.column :tag_count_general, :integer, :null => false, :default => 0
@@ -35,22 +44,20 @@ class CreatePosts < ActiveRecord::Migration
# File
t.column :file_ext, :string, :null => false
t.column :file_size, :integer, :null => false
t.column :image_width, :integer, :null => false
t.column :image_height, :integer, :null => false
t.column :file_size, :integer, :null => false
end
add_index :posts, :md5, :unique => true
add_index :posts, :created_at
add_index :posts, :last_commented_at
add_index :posts, :last_noted_at
add_index :posts, :uploader_id
add_index :posts, :approver_id
add_index :posts, :change_seq
add_index :posts, :file_size
add_index :posts, :image_width
add_index :posts, :image_height
add_index :posts, :source
add_index :posts, :view_count
execute "CREATE INDEX index_posts_on_mpixels ON posts (((image_width * image_height)::numeric / 1000000.0))"
@@ -89,7 +96,7 @@ class CreatePosts < ActiveRecord::Migration
execute "CREATE TEXT SEARCH CONFIGURATION public.danbooru (PARSER = public.testparser)"
execute "ALTER TEXT SEARCH CONFIGURATION public.danbooru ADD MAPPING FOR WORD WITH SIMPLE"
execute "SET default_text_search_config = 'public.danbooru'"
execute "CREATE TRIGGER trigger_posts_on_tag_index_update BEFORE INSERT OR UPDATE ON posts FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('tag_index', 'public.danbooru', 'tag_string')"
execute "CREATE TRIGGER trigger_posts_on_tag_index_update BEFORE INSERT OR UPDATE ON posts FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('tag_index', 'public.danbooru', 'tag_string', 'fav_string', 'pool_string', 'uploader_string', 'approver_string')"
end
def self.down

View File

@@ -3,6 +3,7 @@ class CreateTags < ActiveRecord::Migration
create_table :tags do |t|
t.column :name, :string, :null => false
t.column :post_count, :integer, :null => false, :default => 0
t.column :view_count, :integer, :null => false, :default => 0
t.column :category, :integer, :null => false, :default => 0
t.column :related_tags, :text
t.timestamps

View File

@@ -0,0 +1,26 @@
class CreatePostVersions < ActiveRecord::Migration
def self.up
create_table :post_versions do |t|
t.timestamps
# Post
t.column :post_id, :integer, :null => false
# Versioned
t.column :source, :string
t.column :rating, :character, :null => false, :default => 'q'
t.column :tag_string, :text, :null => false
# Updater
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
end
def self.down
drop_table :post_versions
end
end

View File

@@ -0,0 +1,17 @@
class CreateUnapprovals < ActiveRecord::Migration
def self.up
create_table :unapprovals do |t|
t.column :post_id, :integer, :null => false
t.column :reason, :text
t.column :unapprover_id, :integer, :null => false
t.column :unapprover_ip_addr, "inet", :null => false
t.timestamps
end
add_index :unapprovals, :post_id
end
def self.down
drop_table :unapprovals
end
end