implement saved searches, move user boolean settings to bitprefs

This commit is contained in:
r888888888
2014-06-03 15:54:22 -07:00
parent 901aa1264c
commit f02f72fac1
27 changed files with 547 additions and 105 deletions

View File

@@ -422,8 +422,8 @@ CREATE TABLE advertisement_hits (
id integer NOT NULL,
advertisement_id integer NOT NULL,
ip_addr inet NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -460,8 +460,8 @@ CREATE TABLE advertisements (
height integer NOT NULL,
file_name character varying(255) NOT NULL,
is_work_safe boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -491,8 +491,8 @@ ALTER SEQUENCE advertisements_id_seq OWNED BY advertisements.id;
CREATE TABLE amazon_backups (
id integer NOT NULL,
last_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -526,8 +526,8 @@ CREATE TABLE artist_commentaries (
original_description text,
translated_title text,
translated_description text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -563,8 +563,8 @@ CREATE TABLE artist_commentary_versions (
original_description text,
translated_title text,
translated_description text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -596,8 +596,8 @@ CREATE TABLE artist_urls (
artist_id integer NOT NULL,
url text NOT NULL,
normalized_url text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -635,8 +635,8 @@ CREATE TABLE artist_versions (
group_name character varying(255),
url_string text,
is_banned boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -672,8 +672,8 @@ CREATE TABLE artists (
other_names text,
other_names_index tsvector,
group_name character varying(255),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -706,8 +706,8 @@ CREATE TABLE bans (
reason text NOT NULL,
banner_id integer NOT NULL,
expires_at timestamp without time zone NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -773,8 +773,8 @@ CREATE TABLE comment_votes (
comment_id integer NOT NULL,
user_id integer NOT NULL,
score integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -809,8 +809,8 @@ CREATE TABLE comments (
ip_addr inet NOT NULL,
body_index tsvector NOT NULL,
score integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
updater_id integer,
updater_ip_addr inet,
do_not_bump_post boolean DEFAULT false NOT NULL
@@ -850,8 +850,8 @@ CREATE TABLE delayed_jobs (
locked_at timestamp without time zone,
failed_at timestamp without time zone,
locked_by character varying(255),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
queue character varying(255)
);
@@ -889,8 +889,8 @@ CREATE TABLE dmails (
message_index tsvector NOT NULL,
is_read boolean DEFAULT false NOT NULL,
is_deleted boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
creator_ip_addr inet DEFAULT '127.0.0.1'::inet NOT NULL
);
@@ -1956,8 +1956,8 @@ CREATE TABLE forum_posts (
body text NOT NULL,
text_index tsvector NOT NULL,
is_deleted boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -1994,8 +1994,8 @@ CREATE TABLE forum_topics (
is_locked boolean DEFAULT false NOT NULL,
is_deleted boolean DEFAULT false NOT NULL,
text_index tsvector NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
category_id integer DEFAULT 0 NOT NULL
);
@@ -2028,8 +2028,8 @@ CREATE TABLE ip_bans (
creator_id integer NOT NULL,
ip_addr inet NOT NULL,
reason text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2061,8 +2061,8 @@ CREATE TABLE janitor_trials (
creator_id integer NOT NULL,
user_id integer NOT NULL,
original_level integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2093,8 +2093,8 @@ CREATE TABLE key_values (
id integer NOT NULL,
key character varying(255) NOT NULL,
value text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2125,8 +2125,8 @@ CREATE TABLE mod_actions (
id integer NOT NULL,
creator_id integer NOT NULL,
description text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2158,8 +2158,8 @@ CREATE TABLE news_updates (
message text NOT NULL,
creator_id integer NOT NULL,
updater_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2198,8 +2198,8 @@ CREATE TABLE note_versions (
height integer NOT NULL,
is_active boolean DEFAULT true NOT NULL,
body text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
version integer DEFAULT 0 NOT NULL
);
@@ -2238,8 +2238,8 @@ CREATE TABLE notes (
is_active boolean DEFAULT true NOT NULL,
body text NOT NULL,
body_index tsvector NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
version integer DEFAULT 0 NOT NULL
);
@@ -2273,8 +2273,8 @@ CREATE TABLE pool_versions (
post_ids text DEFAULT ''::text NOT NULL,
updater_id integer NOT NULL,
updater_ip_addr inet NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
name character varying(255)
);
@@ -2311,8 +2311,8 @@ CREATE TABLE pools (
post_ids text DEFAULT ''::text NOT NULL,
post_count integer DEFAULT 0 NOT NULL,
is_deleted boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
category character varying(255) DEFAULT 'series'::character varying NOT NULL
);
@@ -2346,8 +2346,8 @@ CREATE TABLE post_appeals (
creator_id integer NOT NULL,
creator_ip_addr integer NOT NULL,
reason text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2378,8 +2378,8 @@ CREATE TABLE post_disapprovals (
id integer NOT NULL,
user_id integer NOT NULL,
post_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2413,8 +2413,8 @@ CREATE TABLE post_flags (
creator_ip_addr inet NOT NULL,
reason text,
is_resolved boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2443,8 +2443,8 @@ ALTER SEQUENCE post_flags_id_seq OWNED BY post_flags.id;
CREATE TABLE post_versions (
id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
post_id integer NOT NULL,
tags text DEFAULT ''::text NOT NULL,
rating character(1),
@@ -2483,8 +2483,8 @@ CREATE TABLE post_votes (
post_id integer NOT NULL,
user_id integer NOT NULL,
score integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2513,8 +2513,8 @@ ALTER SEQUENCE post_votes_id_seq OWNED BY post_votes.id;
CREATE TABLE posts (
id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
up_score integer DEFAULT 0 NOT NULL,
down_score integer DEFAULT 0 NOT NULL,
score integer DEFAULT 0 NOT NULL,
@@ -2574,6 +2574,40 @@ CREATE SEQUENCE posts_id_seq
ALTER SEQUENCE posts_id_seq OWNED BY posts.id;
--
-- Name: saved_searches; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE saved_searches (
id integer NOT NULL,
user_id integer,
tag_query text,
name text,
category character varying(255),
created_at timestamp without time zone,
updated_at timestamp without time zone
);
--
-- Name: saved_searches_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE saved_searches_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: saved_searches_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE saved_searches_id_seq OWNED BY saved_searches.id;
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@@ -2595,8 +2629,8 @@ CREATE TABLE tag_aliases (
creator_ip_addr inet NOT NULL,
forum_topic_id integer,
status text DEFAULT 'pending'::text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2632,8 +2666,8 @@ CREATE TABLE tag_implications (
creator_ip_addr inet NOT NULL,
forum_topic_id integer,
status text DEFAULT 'pending'::text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2669,8 +2703,8 @@ CREATE TABLE tag_subscriptions (
is_public boolean DEFAULT true NOT NULL,
last_accessed_at timestamp without time zone,
is_opted_in boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2704,8 +2738,8 @@ CREATE TABLE tags (
category integer DEFAULT 0 NOT NULL,
related_tags text,
related_tags_updated_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
is_locked boolean DEFAULT false NOT NULL
);
@@ -2738,8 +2772,8 @@ CREATE TABLE transaction_log_items (
category character varying(255),
user_id integer,
data text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2779,8 +2813,8 @@ CREATE TABLE uploads (
backtrace text,
post_id integer,
md5_confirmation character varying(255),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
server text,
parent_id integer
);
@@ -2815,8 +2849,8 @@ CREATE TABLE user_feedback (
creator_id integer NOT NULL,
category character varying(255) NOT NULL,
body text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2852,8 +2886,8 @@ CREATE TABLE user_name_change_requests (
desired_name character varying(255),
change_reason text,
rejection_reason text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2884,8 +2918,8 @@ CREATE TABLE user_password_reset_nonces (
id integer NOT NULL,
key character varying(255) NOT NULL,
email character varying(255) NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2914,42 +2948,31 @@ ALTER SEQUENCE user_password_reset_nonces_id_seq OWNED BY user_password_reset_no
CREATE TABLE users (
id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
name character varying(255) NOT NULL,
password_hash character varying(255) NOT NULL,
email character varying(255),
email_verification_key character varying(255),
inviter_id integer,
is_banned boolean DEFAULT false NOT NULL,
level integer DEFAULT 0 NOT NULL,
base_upload_limit integer DEFAULT 10 NOT NULL,
last_logged_in_at timestamp without time zone,
last_forum_read_at timestamp without time zone,
has_mail boolean DEFAULT false NOT NULL,
recent_tags text,
post_upload_count integer DEFAULT 0 NOT NULL,
post_update_count integer DEFAULT 0 NOT NULL,
note_update_count integer DEFAULT 0 NOT NULL,
favorite_count integer DEFAULT 0 NOT NULL,
receive_email_notifications boolean DEFAULT false NOT NULL,
comment_threshold integer DEFAULT (-1) NOT NULL,
always_resize_images boolean DEFAULT false NOT NULL,
default_image_size character varying(255) DEFAULT 'large'::character varying NOT NULL,
favorite_tags text,
blacklisted_tags text,
time_zone character varying(255) DEFAULT 'Eastern Time (US & Canada)'::character varying NOT NULL,
bcrypt_password_hash text,
enable_post_navigation boolean DEFAULT true NOT NULL,
new_post_navigation_layout boolean DEFAULT true NOT NULL,
enable_privacy_mode boolean DEFAULT false NOT NULL,
enable_sequential_post_navigation boolean DEFAULT true NOT NULL,
per_page integer DEFAULT 20 NOT NULL,
hide_deleted_posts boolean DEFAULT false NOT NULL,
style_usernames boolean DEFAULT false NOT NULL,
enable_auto_complete boolean DEFAULT true NOT NULL,
custom_style text,
show_deleted_children boolean DEFAULT false NOT NULL
bit_prefs bigint DEFAULT 0 NOT NULL
);
@@ -2984,8 +3007,8 @@ CREATE TABLE wiki_page_versions (
title character varying(255) NOT NULL,
body text NOT NULL,
is_locked boolean NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
other_names text
);
@@ -3020,8 +3043,8 @@ CREATE TABLE wiki_pages (
body text NOT NULL,
body_index tsvector NOT NULL,
is_locked boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
updater_id integer,
other_names text,
other_names_index tsvector
@@ -3971,6 +3994,13 @@ ALTER TABLE ONLY post_votes ALTER COLUMN id SET DEFAULT nextval('post_votes_id_s
ALTER TABLE ONLY posts ALTER COLUMN id SET DEFAULT nextval('posts_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY saved_searches ALTER COLUMN id SET DEFAULT nextval('saved_searches_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -4311,6 +4341,14 @@ ALTER TABLE ONLY posts
ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
--
-- Name: saved_searches_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY saved_searches
ADD CONSTRAINT saved_searches_pkey PRIMARY KEY (id);
--
-- Name: tag_aliases_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@@ -6381,6 +6419,27 @@ CREATE INDEX index_posts_on_uploader_id ON posts USING btree (uploader_id);
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:
--
CREATE INDEX index_saved_searches_on_category ON saved_searches USING btree (category);
--
-- Name: index_saved_searches_on_tag_query; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_saved_searches_on_tag_query ON saved_searches USING btree (tag_query);
--
-- Name: index_saved_searches_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_saved_searches_on_user_id ON saved_searches USING btree (user_id);
--
-- Name: index_tag_aliases_on_antecedent_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -6800,5 +6859,9 @@ INSERT INTO schema_migrations (version) VALUES ('20140428015134');
INSERT INTO schema_migrations (version) VALUES ('20140505000956');
INSERT INTO schema_migrations (version) VALUES ('20140603225334');
INSERT INTO schema_migrations (version) VALUES ('20140604002414');
INSERT INTO schema_migrations (version) VALUES ('20140613004559');