diff --git a/Gemfile b/Gemfile index 9d2034526..20ea1f1bf 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ group :assets do gem "therubyracer" end -gem "rails", "3.1.1" +gem "rails", "3.1.3" gem "pg" gem "memcache-client", :require => "memcache" gem "delayed_job" diff --git a/Gemfile.lock b/Gemfile.lock index 46af8084b..f97f92b86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/ernie/meta_search.git - revision: 34a574f9b6d602169cff6d551293256bc0debc65 + revision: 1b8522a4129b5771c920898cb05badbe119c2f35 specs: meta_search (1.1.1) actionpack (~> 3.1.0) @@ -17,45 +17,45 @@ GIT GIT remote: http://github.com/EmmanuelOga/ffaker.git - revision: 80dc4cf8531b12bf6f5425d2a35b27be91acc447 + revision: f95ce5645d706d865990184ff83d40fe8ccc5e49 specs: - ffaker (1.8.1) + ffaker (1.10.1) GEM remote: http://gemcutter.org/ specs: - actionmailer (3.1.1) - actionpack (= 3.1.1) + actionmailer (3.1.3) + actionpack (= 3.1.3) mail (~> 2.3.0) - actionpack (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) + actionpack (3.1.3) + activemodel (= 3.1.3) + activesupport (= 3.1.3) builder (~> 3.0.0) erubis (~> 2.7.0) i18n (~> 0.6) - rack (~> 1.3.2) + rack (~> 1.3.5) rack-cache (~> 1.1) rack-mount (~> 0.8.2) rack-test (~> 0.6.1) - sprockets (~> 2.0.2) - activemodel (3.1.1) - activesupport (= 3.1.1) + sprockets (~> 2.0.3) + activemodel (3.1.3) + activesupport (= 3.1.3) builder (~> 3.0.0) i18n (~> 0.6) - activerecord (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) + activerecord (3.1.3) + activemodel (= 3.1.3) + activesupport (= 3.1.3) arel (~> 2.2.1) tzinfo (~> 0.3.29) - activeresource (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - activesupport (3.1.1) + activeresource (3.1.3) + activemodel (= 3.1.3) + activesupport (= 3.1.3) + activesupport (3.1.3) multi_json (~> 1.0) arel (2.2.1) awesome_print (0.4.0) builder (3.0.0) - chronic (0.6.4) + chronic (0.6.6) coderay (0.9.8) daemons (1.1.4) delayed_job (2.1.4) @@ -64,12 +64,12 @@ GEM erubis (2.7.0) execjs (1.2.9) multi_json (~> 1.0) - factory_girl (2.2.0) + factory_girl (2.3.2) activesupport hike (1.2.1) i18n (0.6.0) - json (1.6.1) - libv8 (3.3.10.2) + json (1.6.2) + libv8 (3.3.10.4) mail (2.3.0) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -86,15 +86,15 @@ GEM mime-types (1.17.2) mocha (0.10.0) metaclass (~> 0.0.1) - multi_json (1.0.3) - net-http-digest_auth (1.1.1) + multi_json (1.0.4) + net-http-digest_auth (1.2) net-http-persistent (1.9) nokogiri (1.5.0) pg (0.11.0) polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) - pry (0.9.7.3) + pry (0.9.7.4) coderay (~> 0.9.8) method_source (~> 0.6.7) ruby_parser (>= 2.3.1) @@ -108,17 +108,17 @@ GEM rack rack-test (0.6.1) rack (>= 1.0) - rails (3.1.1) - actionmailer (= 3.1.1) - actionpack (= 3.1.1) - activerecord (= 3.1.1) - activeresource (= 3.1.1) - activesupport (= 3.1.1) + rails (3.1.3) + actionmailer (= 3.1.3) + actionpack (= 3.1.3) + activerecord (= 3.1.3) + activeresource (= 3.1.3) + activesupport (= 3.1.3) bundler (~> 1.0) - railties (= 3.1.1) - railties (3.1.1) - actionpack (= 3.1.1) - activesupport (= 3.1.1) + railties (= 3.1.3) + railties (3.1.3) + actionpack (= 3.1.3) + activesupport (= 3.1.3) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -129,8 +129,8 @@ GEM rmagick (2.13.1) ruby_parser (2.3.1) sexp_processor (~> 3.0) - sass (3.1.10) - sexp_processor (3.0.7) + sass (3.1.11) + sexp_processor (3.0.8) shoulda (2.11.3) silent-postgres (0.1.1) simple_form (1.5.2) @@ -148,15 +148,15 @@ GEM super_exception_notifier (3.0.13) actionmailer rake - therubyracer (0.9.8) + therubyracer (0.9.9) libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.30) - uglifier (1.0.4) + tzinfo (0.3.31) + uglifier (1.1.0) execjs (>= 0.3.0) multi_json (>= 1.0.2) webrobots (0.0.12) @@ -180,7 +180,7 @@ DEPENDENCIES nokogiri pg pry - rails (= 3.1.1) + rails (= 3.1.3) rmagick sanitize! sass diff --git a/script/setup_directories.sh b/script/setup_directories.sh deleted file mode 100644 index a202b00b2..000000000 --- a/script/setup_directories.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# this should be run after the initial capistrano deployment - -mv /var/www/danbooru/public/data/sample /var/www/danbooru/shared/large -mv /var/www/danbooru/public/data/preview /var/www/danbooru/shared/preview -mv /var/www/danbooru/public/data /var/www/danbooru/shared/original -mkdir -p /var/www/danbooru/shared/medium - diff --git a/script/upgrade_schema.rb b/script/upgrade_schema.rb new file mode 100644 index 000000000..7c81f0e2b --- /dev/null +++ b/script/upgrade_schema.rb @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) + +PoolVersion.find_each do |version| + version.update_column(:post_ids, version.post_ids.scan(/\d+/).in_groups_of(2).map {|x| x.first}.join(" ")) +end + +TagImplication.find_each do |impl| + impl.update_descendant_names! +end diff --git a/script/upgrade_schema.sql b/script/upgrade_schema.sql index 5fa4edd50..d9bd464c5 100644 --- a/script/upgrade_schema.sql +++ b/script/upgrade_schema.sql @@ -31,6 +31,7 @@ alter table artists add column other_names_index tsvector; alter table artists drop column updater_ip_addr; alter table artists rename column updater_id to creator_id; CREATE INDEX index_artists_on_other_names_index ON artists USING GIN (other_names_index); +update artists set other_names_index = to_tsvector('public.danbooru', other_names); CREATE TRIGGER trigger_artists_on_update BEFORE INSERT OR UPDATE ON artists FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('other_names_index', 'public.danbooru', 'other_names'); alter table banned_ips rename to ip_bans; @@ -113,6 +114,7 @@ ALTER SEQUENCE dmails_id_seq OWNED BY dmails.id; ALTER TABLE dmails ALTER COLUMN id SET DEFAULT nextval('dmails_id_seq'::regclass); ALTER TABLE ONLY dmails ADD CONSTRAINT dmails_pkey PRIMARY KEY (id); CREATE INDEX index_dmails_on_message_index ON dmails USING gin (message_index); +update dmails set message_index = to_tsvector('pg_catalog.english', title || ' ' || body); CREATE INDEX index_dmails_on_owner_id ON dmails USING btree (owner_id); 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'); insert into dmails (owner_id, from_id, to_id, title, body, is_read, is_deleted, created_at, updated_at) select dmails_orig.from_id, dmails_orig.from_id, dmails_orig.to_id, dmails_orig.title, dmails_orig.body, dmails_orig.has_seen, false, dmails_orig.created_at, dmails_orig.created_at from dmails_orig; @@ -2895,6 +2897,7 @@ ALTER TABLE ONLY forum_topics CREATE INDEX index_forum_topics_on_creator_id ON forum_topics USING btree (creator_id); CREATE INDEX index_forum_topics_on_original_post_id ON forum_topics USING btree (original_post_id); CREATE INDEX index_forum_topics_on_text_index ON forum_topics USING gin (text_index); +update forum_topics set text_index = to_tsvector('pg_catalog.english', title); CREATE TRIGGER trigger_forum_topics_on_update BEFORE INSERT OR UPDATE ON forum_topics FOR EACH ROW @@ -3015,6 +3018,7 @@ alter table posts add column is_deleted boolean not null default false; update posts set is_pending = true where status = 'pending'; update posts set is_flagged = true where status = 'flagged'; update posts set is_deleted = true where status = 'deleted'; +update posts set up_score = score; alter table posts drop column status; alter table posts drop column sample_width; alter table posts drop column sample_height; @@ -3071,6 +3075,7 @@ update tag_aliases set consequent_name = (select _.name from tags _ where _.id = alter table tag_aliases drop column alias_id; alter table tag_aliases add column created_at timestamp without time zone default now(); alter table tag_aliases add column updated_at timestamp without time zone default now(); +update tag_aliases set creator_id = 1 where creator_id is null; alter table tag_implications drop constraint fk_tag_implications__child; alter table tag_implications drop constraint fk_tag_implications__parent; @@ -3090,6 +3095,7 @@ alter table tag_implications drop column predicate_id; alter table tag_implications add column forum_topic_id integer; alter table tag_implications add column created_at timestamp without time zone default now(); alter table tag_implications add column updated_at timestamp without time zone default now(); +update tag_implications set creator_id = 1 where creator_id is null; alter table tag_subscriptions drop constraint tag_subscriptions_user_id_fkey; alter table tag_subscriptions rename column user_id to creator_id; @@ -3161,7 +3167,7 @@ update users set blacklisted_tags = (select string_agg(_.tags, E'\n') from user_ update users set post_update_count = (select count(*) from post_versions where updater_id = users.id); update users set note_update_count = (select count(*) from note_versions where updater_id = users.id); update users set favorite_count = (select count(*) from favorites where user_id = users.id); -drop table user_blacklisted_tags; +-- drop table user_blacklisted_tags; CREATE TABLE user_password_reset_nonces ( id integer NOT NULL,