fixed tests

This commit is contained in:
albert
2011-10-16 01:40:42 -04:00
parent d2f2203c33
commit a7267cf00b
12 changed files with 141 additions and 30 deletions

View File

@@ -439,6 +439,7 @@ CREATE TABLE advertisements (
width integer NOT NULL,
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,
updated_at timestamp without time zone
);
@@ -541,6 +542,7 @@ CREATE TABLE artist_versions (
other_names text,
group_name character varying(255),
url_string text,
is_banned boolean DEFAULT false NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -1935,7 +1937,7 @@ CREATE TABLE notes (
height integer NOT NULL,
is_active boolean DEFAULT true NOT NULL,
body text NOT NULL,
text_index tsvector NOT NULL,
body_index tsvector NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@@ -2228,6 +2230,7 @@ CREATE TABLE posts (
pool_string text DEFAULT ''::text NOT NULL,
last_noted_at timestamp without time zone,
last_commented_at timestamp without time zone,
fav_count integer DEFAULT 0 NOT NULL,
tag_string text DEFAULT ''::text NOT NULL,
tag_index tsvector,
tag_count integer DEFAULT 0 NOT NULL,
@@ -2356,9 +2359,10 @@ CREATE TABLE tag_subscriptions (
tag_query character varying(255) NOT NULL,
post_ids text NOT NULL,
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,
updated_at timestamp without time zone,
last_accessed_at timestamp without time zone
updated_at timestamp without time zone
);
@@ -2430,11 +2434,11 @@ CREATE TABLE uploads (
uploader_ip_addr inet NOT NULL,
tag_string text NOT NULL,
status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
backtrace text,
post_id integer,
md5_confirmation character varying(255),
created_at timestamp without time zone,
updated_at timestamp without time zone,
backtrace text
updated_at timestamp without time zone
);
@@ -3232,6 +3236,13 @@ CREATE INDEX index_artist_urls_on_artist_id ON artist_urls USING btree (artist_i
CREATE INDEX index_artist_urls_on_normalized_url ON artist_urls USING btree (normalized_url);
--
-- Name: index_artist_urls_on_url; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_artist_urls_on_url ON artist_urls USING btree (url);
--
-- Name: index_artist_versions_on_artist_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -3274,6 +3285,13 @@ CREATE UNIQUE INDEX index_artists_on_name ON artists USING btree (name);
CREATE INDEX index_artists_on_other_names_index ON artists USING gin (other_names_index);
--
-- Name: index_bans_on_banner_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_bans_on_banner_id ON bans USING btree (banner_id);
--
-- Name: index_bans_on_expires_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -3288,6 +3306,20 @@ CREATE INDEX index_bans_on_expires_at ON bans USING btree (expires_at);
CREATE INDEX index_bans_on_user_id ON bans USING btree (user_id);
--
-- Name: index_comment_votes_on_comment_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_comment_votes_on_comment_id ON comment_votes USING btree (comment_id);
--
-- Name: index_comment_votes_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_comment_votes_on_created_at ON comment_votes USING btree (created_at);
--
-- Name: index_comment_votes_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -4807,6 +4839,13 @@ CREATE INDEX index_note_versions_on_updater_id ON note_versions USING btree (upd
CREATE INDEX index_note_versions_on_updater_ip_addr ON note_versions USING btree (updater_ip_addr);
--
-- Name: index_notes_on_body_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_notes_on_body_index ON notes USING gin (body_index);
--
-- Name: index_notes_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -4821,13 +4860,6 @@ CREATE INDEX index_notes_on_creator_id ON notes USING btree (creator_id);
CREATE INDEX index_notes_on_post_id ON notes USING btree (post_id);
--
-- Name: index_notes_on_text_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_notes_on_text_index ON notes USING gin (text_index);
--
-- Name: index_pool_versions_on_pool_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -4835,6 +4867,20 @@ CREATE INDEX index_notes_on_text_index ON notes USING gin (text_index);
CREATE INDEX index_pool_versions_on_pool_id ON pool_versions USING btree (pool_id);
--
-- Name: index_pool_versions_on_updater_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_pool_versions_on_updater_id ON pool_versions USING btree (updater_id);
--
-- Name: index_pool_versions_on_updater_ip_addr; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_pool_versions_on_updater_ip_addr ON pool_versions USING btree (updater_ip_addr);
--
-- Name: index_pools_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -4926,6 +4972,20 @@ CREATE INDEX index_post_versions_on_updater_id ON post_versions USING btree (upd
CREATE INDEX index_post_versions_on_updater_ip_addr ON post_versions USING btree (updater_ip_addr);
--
-- Name: index_post_votes_on_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_post_votes_on_post_id ON post_votes USING btree (post_id);
--
-- Name: index_post_votes_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_post_votes_on_user_id ON post_votes USING btree (user_id);
--
-- Name: index_posts_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -5003,6 +5063,20 @@ CREATE INDEX index_posts_on_source ON posts USING btree (source);
CREATE INDEX index_posts_on_tags_index ON posts USING gin (tag_index);
--
-- Name: index_posts_on_uploader_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
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_tag_aliases_on_antecedent_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -5052,6 +5126,20 @@ CREATE INDEX index_tag_subscriptions_on_name ON tag_subscriptions USING btree (n
CREATE UNIQUE INDEX index_tags_on_name ON tags USING btree (name);
--
-- Name: index_uploads_on_uploader_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_uploads_on_uploader_id ON uploads USING btree (uploader_id);
--
-- Name: index_uploads_on_uploader_ip_addr; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_uploads_on_uploader_ip_addr ON uploads USING btree (uploader_ip_addr);
--
-- Name: index_user_feedback_on_creator_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -5175,7 +5263,7 @@ CREATE TRIGGER trigger_forum_topics_on_update
CREATE TRIGGER trigger_notes_on_update
BEFORE INSERT OR UPDATE ON notes
FOR EACH ROW
EXECUTE PROCEDURE tsvector_update_trigger('text_index', 'pg_catalog.english', 'body');
EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'pg_catalog.english', 'body');
--

View File

@@ -50,7 +50,7 @@ if Comment.count == 0
puts "Creating comments"
Post.all.each do |post|
rand(30).times do
Comment.create(:post_id => post.id, :body => rand(1_000_000).to_s)
Comment.create(:post_id => post.id, :body => Time.now.to_f.to_s)
end
end
else
@@ -61,7 +61,7 @@ if Note.count == 0
puts "Creating notes"
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 => rand(1_000_000).to_s)
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)
@@ -106,7 +106,7 @@ if Pool.count == 0
1.upto(20) do |i|
pool = Pool.create(:name => i.to_s)
33.times do |j|
rand(33).times do |j|
pool.add!(Post.order("random()").first)
end
end
@@ -124,6 +124,18 @@ 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
end
end
if TagSubscription.count == 0
puts "Creating tag subscriptions"
TagSubscription.create(:name => "0", :tag_query => Tag.order("random()").first.name)