forked from e621ng/e621ng
Revert "remove mpixel search, remove some unused indexes on posts"
This reverts commit 11e550c385
.
This commit is contained in:
parent
7ad7101bc2
commit
5063e326e3
3
Procfile
3
Procfile
@ -1,3 +0,0 @@
|
|||||||
web: bundle exec rails server
|
|
||||||
iqdb: iqdb listen localhost:8000 tmp/iqdb.db
|
|
||||||
rabbitmq: /usr/local/sbin/rabbitmq-server
|
|
@ -243,6 +243,7 @@
|
|||||||
"comment", "comment_asc",
|
"comment", "comment_asc",
|
||||||
"note", "note_asc",
|
"note", "note_asc",
|
||||||
"artcomm", "artcomm_asc",
|
"artcomm", "artcomm_asc",
|
||||||
|
"mpixels", "mpixels_asc",
|
||||||
"portrait", "landscape",
|
"portrait", "landscape",
|
||||||
"filesize", "filesize_asc",
|
"filesize", "filesize_asc",
|
||||||
"rank"
|
"rank"
|
||||||
|
@ -119,6 +119,7 @@ class PostQueryBuilder
|
|||||||
end
|
end
|
||||||
|
|
||||||
relation = add_range_relation(q[:post_id], "posts.id", relation)
|
relation = add_range_relation(q[:post_id], "posts.id", relation)
|
||||||
|
relation = add_range_relation(q[:mpixels], "posts.image_width * posts.image_height / 1000000.0", relation)
|
||||||
relation = add_range_relation(q[:ratio], "ROUND(1.0 * posts.image_width / GREATEST(1, posts.image_height), 2)", relation)
|
relation = add_range_relation(q[:ratio], "ROUND(1.0 * posts.image_width / GREATEST(1, posts.image_height), 2)", relation)
|
||||||
relation = add_range_relation(q[:width], "posts.image_width", relation)
|
relation = add_range_relation(q[:width], "posts.image_width", relation)
|
||||||
relation = add_range_relation(q[:height], "posts.image_height", relation)
|
relation = add_range_relation(q[:height], "posts.image_height", relation)
|
||||||
@ -368,6 +369,16 @@ class PostQueryBuilder
|
|||||||
relation = relation.joins("INNER JOIN artist_commentaries ON artist_commentaries.post_id = posts.id")
|
relation = relation.joins("INNER JOIN artist_commentaries ON artist_commentaries.post_id = posts.id")
|
||||||
relation = relation.order("artist_commentaries.updated_at ASC, posts.id DESC")
|
relation = relation.order("artist_commentaries.updated_at ASC, posts.id DESC")
|
||||||
|
|
||||||
|
when "mpixels", "mpixels_desc"
|
||||||
|
relation = relation.where("posts.image_width is not null and posts.image_height is not null")
|
||||||
|
# Use "w*h/1000000", even though "w*h" would give the same result, so this can use
|
||||||
|
# the posts_mpixels index.
|
||||||
|
relation = relation.order("posts.image_width * posts.image_height / 1000000.0 DESC, posts.id DESC")
|
||||||
|
|
||||||
|
when "mpixels_asc"
|
||||||
|
relation = relation.where("posts.image_width is not null and posts.image_height is not null")
|
||||||
|
relation = relation.order("posts.image_width * posts.image_height / 1000000.0 ASC, posts.id DESC")
|
||||||
|
|
||||||
when "portrait"
|
when "portrait"
|
||||||
relation = relation.order("1.0 * posts.image_width / GREATEST(1, posts.image_height) ASC, posts.id DESC")
|
relation = relation.order("1.0 * posts.image_width / GREATEST(1, posts.image_height) ASC, posts.id DESC")
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
class Tag < ActiveRecord::Base
|
class Tag < ActiveRecord::Base
|
||||||
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-pool|pool|ordpool|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|ratio|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv"
|
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-pool|pool|ordpool|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|ratio|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv"
|
||||||
SUBQUERY_METATAGS = "commenter|comm|noter|noteupdater|artcomm"
|
SUBQUERY_METATAGS = "commenter|comm|noter|noteupdater|artcomm"
|
||||||
attr_accessible :category, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin]
|
attr_accessible :category, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin]
|
||||||
attr_accessible :is_locked, :as => [:moderator, :janitor, :admin]
|
attr_accessible :is_locked, :as => [:moderator, :janitor, :admin]
|
||||||
@ -487,6 +487,9 @@ class Tag < ActiveRecord::Base
|
|||||||
when "height"
|
when "height"
|
||||||
q[:height] = parse_helper($2)
|
q[:height] = parse_helper($2)
|
||||||
|
|
||||||
|
when "mpixels"
|
||||||
|
q[:mpixels] = parse_helper_fudged($2, :float)
|
||||||
|
|
||||||
when "ratio"
|
when "ratio"
|
||||||
q[:ratio] = parse_helper($2, :ratio)
|
q[:ratio] = parse_helper($2, :ratio)
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
class RemoveUnusedIndexes < ActiveRecord::Migration
|
|
||||||
def change
|
|
||||||
execute "set statement_timeout = 0"
|
|
||||||
remove_index :posts, :mpixels
|
|
||||||
remove_index :posts, :source
|
|
||||||
remove_index :posts, :uploader_ip_addr
|
|
||||||
end
|
|
||||||
end
|
|
195
db/structure.sql
195
db/structure.sql
@ -3,7 +3,6 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
SET statement_timeout = 0;
|
SET statement_timeout = 0;
|
||||||
SET lock_timeout = 0;
|
|
||||||
SET client_encoding = 'UTF8';
|
SET client_encoding = 'UTF8';
|
||||||
SET standard_conforming_strings = on;
|
SET standard_conforming_strings = on;
|
||||||
SET check_function_bodies = false;
|
SET check_function_bodies = false;
|
||||||
@ -422,8 +421,8 @@ CREATE TABLE advertisement_hits (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
advertisement_id integer NOT NULL,
|
advertisement_id integer NOT NULL,
|
||||||
ip_addr inet NOT NULL,
|
ip_addr inet NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -460,8 +459,8 @@ CREATE TABLE advertisements (
|
|||||||
height integer NOT NULL,
|
height integer NOT NULL,
|
||||||
file_name character varying(255) NOT NULL,
|
file_name character varying(255) NOT NULL,
|
||||||
is_work_safe boolean DEFAULT false NOT NULL,
|
is_work_safe boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -491,8 +490,8 @@ ALTER SEQUENCE advertisements_id_seq OWNED BY advertisements.id;
|
|||||||
CREATE TABLE amazon_backups (
|
CREATE TABLE amazon_backups (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
last_id integer,
|
last_id integer,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -558,8 +557,8 @@ CREATE TABLE artist_commentaries (
|
|||||||
original_description text,
|
original_description text,
|
||||||
translated_title text,
|
translated_title text,
|
||||||
translated_description text,
|
translated_description text,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -595,8 +594,8 @@ CREATE TABLE artist_commentary_versions (
|
|||||||
original_description text,
|
original_description text,
|
||||||
translated_title text,
|
translated_title text,
|
||||||
translated_description text,
|
translated_description text,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -628,8 +627,8 @@ CREATE TABLE artist_urls (
|
|||||||
artist_id integer NOT NULL,
|
artist_id integer NOT NULL,
|
||||||
url text NOT NULL,
|
url text NOT NULL,
|
||||||
normalized_url text NOT NULL,
|
normalized_url text NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -667,9 +666,8 @@ CREATE TABLE artist_versions (
|
|||||||
group_name character varying(255),
|
group_name character varying(255),
|
||||||
url_string text,
|
url_string text,
|
||||||
is_banned boolean DEFAULT false NOT NULL,
|
is_banned boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL
|
||||||
normalized_url_string text
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -705,8 +703,8 @@ CREATE TABLE artists (
|
|||||||
other_names text,
|
other_names text,
|
||||||
other_names_index tsvector,
|
other_names_index tsvector,
|
||||||
group_name character varying(255),
|
group_name character varying(255),
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -739,8 +737,8 @@ CREATE TABLE bans (
|
|||||||
reason text NOT NULL,
|
reason text NOT NULL,
|
||||||
banner_id integer NOT NULL,
|
banner_id integer NOT NULL,
|
||||||
expires_at timestamp without time zone NOT NULL,
|
expires_at timestamp without time zone NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -806,8 +804,8 @@ CREATE TABLE comment_votes (
|
|||||||
comment_id integer NOT NULL,
|
comment_id integer NOT NULL,
|
||||||
user_id integer NOT NULL,
|
user_id integer NOT NULL,
|
||||||
score integer NOT NULL,
|
score integer NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -842,8 +840,8 @@ CREATE TABLE comments (
|
|||||||
ip_addr inet NOT NULL,
|
ip_addr inet NOT NULL,
|
||||||
body_index tsvector NOT NULL,
|
body_index tsvector NOT NULL,
|
||||||
score integer DEFAULT 0 NOT NULL,
|
score integer DEFAULT 0 NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
updater_id integer,
|
updater_id integer,
|
||||||
updater_ip_addr inet,
|
updater_ip_addr inet,
|
||||||
do_not_bump_post boolean DEFAULT false NOT NULL
|
do_not_bump_post boolean DEFAULT false NOT NULL
|
||||||
@ -883,8 +881,8 @@ CREATE TABLE delayed_jobs (
|
|||||||
locked_at timestamp without time zone,
|
locked_at timestamp without time zone,
|
||||||
failed_at timestamp without time zone,
|
failed_at timestamp without time zone,
|
||||||
locked_by character varying(255),
|
locked_by character varying(255),
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
queue character varying(255)
|
queue character varying(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -954,8 +952,8 @@ CREATE TABLE dmails (
|
|||||||
message_index tsvector NOT NULL,
|
message_index tsvector NOT NULL,
|
||||||
is_read boolean DEFAULT false NOT NULL,
|
is_read boolean DEFAULT false NOT NULL,
|
||||||
is_deleted boolean DEFAULT false NOT NULL,
|
is_deleted boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
creator_ip_addr inet DEFAULT '127.0.0.1'::inet NOT NULL
|
creator_ip_addr inet DEFAULT '127.0.0.1'::inet NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2021,8 +2019,8 @@ CREATE TABLE forum_posts (
|
|||||||
body text NOT NULL,
|
body text NOT NULL,
|
||||||
text_index tsvector NOT NULL,
|
text_index tsvector NOT NULL,
|
||||||
is_deleted boolean DEFAULT false NOT NULL,
|
is_deleted boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2124,8 +2122,8 @@ CREATE TABLE forum_topics (
|
|||||||
is_locked boolean DEFAULT false NOT NULL,
|
is_locked boolean DEFAULT false NOT NULL,
|
||||||
is_deleted boolean DEFAULT false NOT NULL,
|
is_deleted boolean DEFAULT false NOT NULL,
|
||||||
text_index tsvector NOT NULL,
|
text_index tsvector NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
category_id integer DEFAULT 0 NOT NULL
|
category_id integer DEFAULT 0 NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2158,8 +2156,8 @@ CREATE TABLE ip_bans (
|
|||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
ip_addr inet NOT NULL,
|
ip_addr inet NOT NULL,
|
||||||
reason text NOT NULL,
|
reason text NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2191,8 +2189,8 @@ CREATE TABLE janitor_trials (
|
|||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
user_id integer NOT NULL,
|
user_id integer NOT NULL,
|
||||||
original_level integer NOT NULL,
|
original_level integer NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2223,8 +2221,8 @@ CREATE TABLE key_values (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
key character varying(255) NOT NULL,
|
key character varying(255) NOT NULL,
|
||||||
value text,
|
value text,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2255,8 +2253,8 @@ CREATE TABLE mod_actions (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
description text NOT NULL,
|
description text NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2288,8 +2286,8 @@ CREATE TABLE news_updates (
|
|||||||
message text NOT NULL,
|
message text NOT NULL,
|
||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
updater_id integer NOT NULL,
|
updater_id integer NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2328,8 +2326,8 @@ CREATE TABLE note_versions (
|
|||||||
height integer NOT NULL,
|
height integer NOT NULL,
|
||||||
is_active boolean DEFAULT true NOT NULL,
|
is_active boolean DEFAULT true NOT NULL,
|
||||||
body text NOT NULL,
|
body text NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
version integer DEFAULT 0 NOT NULL
|
version integer DEFAULT 0 NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2368,8 +2366,8 @@ CREATE TABLE notes (
|
|||||||
is_active boolean DEFAULT true NOT NULL,
|
is_active boolean DEFAULT true NOT NULL,
|
||||||
body text NOT NULL,
|
body text NOT NULL,
|
||||||
body_index tsvector NOT NULL,
|
body_index tsvector NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
version integer DEFAULT 0 NOT NULL
|
version integer DEFAULT 0 NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2434,8 +2432,8 @@ CREATE TABLE pool_versions (
|
|||||||
post_ids text DEFAULT ''::text NOT NULL,
|
post_ids text DEFAULT ''::text NOT NULL,
|
||||||
updater_id integer NOT NULL,
|
updater_id integer NOT NULL,
|
||||||
updater_ip_addr inet NOT NULL,
|
updater_ip_addr inet NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
name character varying(255)
|
name character varying(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2472,8 +2470,8 @@ CREATE TABLE pools (
|
|||||||
post_ids text DEFAULT ''::text NOT NULL,
|
post_ids text DEFAULT ''::text NOT NULL,
|
||||||
post_count integer DEFAULT 0 NOT NULL,
|
post_count integer DEFAULT 0 NOT NULL,
|
||||||
is_deleted boolean DEFAULT false NOT NULL,
|
is_deleted boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
category character varying(255) DEFAULT 'series'::character varying NOT NULL
|
category character varying(255) DEFAULT 'series'::character varying NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2507,8 +2505,8 @@ CREATE TABLE post_appeals (
|
|||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
creator_ip_addr integer NOT NULL,
|
creator_ip_addr integer NOT NULL,
|
||||||
reason text,
|
reason text,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2539,8 +2537,8 @@ CREATE TABLE post_disapprovals (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
user_id integer NOT NULL,
|
user_id integer NOT NULL,
|
||||||
post_id integer NOT NULL,
|
post_id integer NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2574,8 +2572,8 @@ CREATE TABLE post_flags (
|
|||||||
creator_ip_addr inet NOT NULL,
|
creator_ip_addr inet NOT NULL,
|
||||||
reason text,
|
reason text,
|
||||||
is_resolved boolean DEFAULT false NOT NULL,
|
is_resolved boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2604,8 +2602,8 @@ ALTER SEQUENCE post_flags_id_seq OWNED BY post_flags.id;
|
|||||||
|
|
||||||
CREATE TABLE post_versions (
|
CREATE TABLE post_versions (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
post_id integer NOT NULL,
|
post_id integer NOT NULL,
|
||||||
tags text DEFAULT ''::text NOT NULL,
|
tags text DEFAULT ''::text NOT NULL,
|
||||||
rating character(1),
|
rating character(1),
|
||||||
@ -2644,8 +2642,8 @@ CREATE TABLE post_votes (
|
|||||||
post_id integer NOT NULL,
|
post_id integer NOT NULL,
|
||||||
user_id integer NOT NULL,
|
user_id integer NOT NULL,
|
||||||
score integer NOT NULL,
|
score integer NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2674,8 +2672,8 @@ ALTER SEQUENCE post_votes_id_seq OWNED BY post_votes.id;
|
|||||||
|
|
||||||
CREATE TABLE posts (
|
CREATE TABLE posts (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
up_score integer DEFAULT 0 NOT NULL,
|
up_score integer DEFAULT 0 NOT NULL,
|
||||||
down_score integer DEFAULT 0 NOT NULL,
|
down_score integer DEFAULT 0 NOT NULL,
|
||||||
score integer DEFAULT 0 NOT NULL,
|
score integer DEFAULT 0 NOT NULL,
|
||||||
@ -2790,8 +2788,8 @@ CREATE TABLE tag_aliases (
|
|||||||
creator_ip_addr inet NOT NULL,
|
creator_ip_addr inet NOT NULL,
|
||||||
forum_topic_id integer,
|
forum_topic_id integer,
|
||||||
status text DEFAULT 'pending'::text NOT NULL,
|
status text DEFAULT 'pending'::text NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2827,8 +2825,8 @@ CREATE TABLE tag_implications (
|
|||||||
creator_ip_addr inet NOT NULL,
|
creator_ip_addr inet NOT NULL,
|
||||||
forum_topic_id integer,
|
forum_topic_id integer,
|
||||||
status text DEFAULT 'pending'::text NOT NULL,
|
status text DEFAULT 'pending'::text NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2864,8 +2862,8 @@ CREATE TABLE tag_subscriptions (
|
|||||||
is_public boolean DEFAULT true NOT NULL,
|
is_public boolean DEFAULT true NOT NULL,
|
||||||
last_accessed_at timestamp without time zone,
|
last_accessed_at timestamp without time zone,
|
||||||
is_opted_in boolean DEFAULT false NOT NULL,
|
is_opted_in boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2899,8 +2897,8 @@ CREATE TABLE tags (
|
|||||||
category integer DEFAULT 0 NOT NULL,
|
category integer DEFAULT 0 NOT NULL,
|
||||||
related_tags text,
|
related_tags text,
|
||||||
related_tags_updated_at timestamp without time zone,
|
related_tags_updated_at timestamp without time zone,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
is_locked boolean DEFAULT false NOT NULL
|
is_locked boolean DEFAULT false NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2933,8 +2931,8 @@ CREATE TABLE transaction_log_items (
|
|||||||
category character varying(255),
|
category character varying(255),
|
||||||
user_id integer,
|
user_id integer,
|
||||||
data text,
|
data text,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -2974,8 +2972,8 @@ CREATE TABLE uploads (
|
|||||||
backtrace text,
|
backtrace text,
|
||||||
post_id integer,
|
post_id integer,
|
||||||
md5_confirmation character varying(255),
|
md5_confirmation character varying(255),
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
server text,
|
server text,
|
||||||
parent_id integer
|
parent_id integer
|
||||||
);
|
);
|
||||||
@ -3010,8 +3008,8 @@ CREATE TABLE user_feedback (
|
|||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
category character varying(255) NOT NULL,
|
category character varying(255) NOT NULL,
|
||||||
body text NOT NULL,
|
body text NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -3047,8 +3045,8 @@ CREATE TABLE user_name_change_requests (
|
|||||||
desired_name character varying(255),
|
desired_name character varying(255),
|
||||||
change_reason text,
|
change_reason text,
|
||||||
rejection_reason text,
|
rejection_reason text,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -3079,8 +3077,8 @@ CREATE TABLE user_password_reset_nonces (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
key character varying(255) NOT NULL,
|
key character varying(255) NOT NULL,
|
||||||
email character varying(255) NOT NULL,
|
email character varying(255) NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -3109,8 +3107,8 @@ ALTER SEQUENCE user_password_reset_nonces_id_seq OWNED BY user_password_reset_no
|
|||||||
|
|
||||||
CREATE TABLE users (
|
CREATE TABLE users (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
name character varying(255) NOT NULL,
|
name character varying(255) NOT NULL,
|
||||||
password_hash character varying(255) NOT NULL,
|
password_hash character varying(255) NOT NULL,
|
||||||
email character varying(255),
|
email character varying(255),
|
||||||
@ -3168,8 +3166,8 @@ CREATE TABLE wiki_page_versions (
|
|||||||
title character varying(255) NOT NULL,
|
title character varying(255) NOT NULL,
|
||||||
body text NOT NULL,
|
body text NOT NULL,
|
||||||
is_locked boolean NOT NULL,
|
is_locked boolean NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
other_names text
|
other_names text
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3204,8 +3202,8 @@ CREATE TABLE wiki_pages (
|
|||||||
body text NOT NULL,
|
body text NOT NULL,
|
||||||
body_index tsvector NOT NULL,
|
body_index tsvector NOT NULL,
|
||||||
is_locked boolean DEFAULT false NOT NULL,
|
is_locked boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
updater_id integer,
|
updater_id integer,
|
||||||
other_names text,
|
other_names text,
|
||||||
other_names_index tsvector
|
other_names_index tsvector
|
||||||
@ -6662,6 +6660,13 @@ CREATE INDEX index_posts_on_last_noted_at ON posts USING btree (last_noted_at);
|
|||||||
CREATE UNIQUE INDEX index_posts_on_md5 ON posts USING btree (md5);
|
CREATE UNIQUE INDEX index_posts_on_md5 ON posts USING btree (md5);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_posts_on_mpixels; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_posts_on_mpixels ON posts USING btree (((((image_width * image_height))::numeric / 1000000.0)));
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_posts_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_posts_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -6676,6 +6681,13 @@ CREATE INDEX index_posts_on_parent_id ON posts USING btree (parent_id);
|
|||||||
CREATE INDEX index_posts_on_pixiv_id ON posts USING btree (pixiv_id) WHERE (pixiv_id IS NOT NULL);
|
CREATE INDEX index_posts_on_pixiv_id ON posts USING btree (pixiv_id) WHERE (pixiv_id IS NOT NULL);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_posts_on_source; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_posts_on_source ON posts USING btree (lower((source)::text));
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_posts_on_source_pattern; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_posts_on_source_pattern; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -6697,6 +6709,13 @@ CREATE INDEX index_posts_on_tags_index ON posts USING gin (tag_index);
|
|||||||
CREATE INDEX index_posts_on_uploader_id ON posts USING btree (uploader_id);
|
CREATE INDEX index_posts_on_uploader_id ON posts USING btree (uploader_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_posts_on_uploader_ip_addr; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_posts_on_uploader_ip_addr ON posts USING btree (uploader_ip_addr);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_saved_searches_on_category; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_saved_searches_on_category; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@ -7155,7 +7174,3 @@ INSERT INTO schema_migrations (version) VALUES ('20141017231608');
|
|||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20141120045943');
|
INSERT INTO schema_migrations (version) VALUES ('20141120045943');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20141203230229');
|
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20150116013315');
|
|
||||||
|
|
||||||
|
@ -1332,6 +1332,8 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
post3 = FactoryGirl.create(:post, :rating => "e", :score => 5, :image_width => 10_000)
|
post3 = FactoryGirl.create(:post, :rating => "e", :score => 5, :image_width => 10_000)
|
||||||
relation = Post.tag_match("order:id")
|
relation = Post.tag_match("order:id")
|
||||||
assert_equal(post1.id, relation.first.id)
|
assert_equal(post1.id, relation.first.id)
|
||||||
|
relation = Post.tag_match("order:mpixels")
|
||||||
|
assert_equal(post3.id, relation.first.id)
|
||||||
relation = Post.tag_match("order:landscape")
|
relation = Post.tag_match("order:landscape")
|
||||||
assert_equal(post3.id, relation.first.id)
|
assert_equal(post3.id, relation.first.id)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user