From 821a22c6073d4b50ae7038e9c1aacbb5e68cd55a Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 11 Jan 2015 19:37:15 +0000 Subject: [PATCH] Update old changesets to subscribe the creator --- ...20150111192335_subscribe_old_changesets.rb | 10 +++++ db/structure.sql | 37 ++++++++++++------- 2 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 db/migrate/20150111192335_subscribe_old_changesets.rb diff --git a/db/migrate/20150111192335_subscribe_old_changesets.rb b/db/migrate/20150111192335_subscribe_old_changesets.rb new file mode 100644 index 000000000..2bc021476 --- /dev/null +++ b/db/migrate/20150111192335_subscribe_old_changesets.rb @@ -0,0 +1,10 @@ +class SubscribeOldChangesets < ActiveRecord::Migration + def up + Changeset.find_each do |changeset| + changeset.subscribers << changeset.user unless changeset.subscribers.exists?(changeset.user) + end + end + + def down + end +end diff --git a/db/structure.sql b/db/structure.sql index 343aec084..9bb9fa5a9 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -126,7 +126,7 @@ CREATE TYPE user_status_enum AS ENUM ( CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer LANGUAGE c STRICT - AS '/srv/www/overpass.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point'; + AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point'; -- @@ -135,7 +135,7 @@ CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint LANGUAGE c STRICT - AS '/srv/www/overpass.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point'; + AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point'; -- @@ -144,7 +144,7 @@ CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint CREATE FUNCTION xid_to_int4(xid) RETURNS integer LANGUAGE c IMMUTABLE STRICT - AS '/srv/www/overpass.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4'; + AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4'; SET default_tablespace = ''; @@ -485,7 +485,7 @@ CREATE TABLE diary_comments ( created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, visible boolean DEFAULT true NOT NULL, - body_format format_enum DEFAULT 'html'::format_enum NOT NULL + body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL ); @@ -523,7 +523,7 @@ CREATE TABLE diary_entries ( longitude double precision, language_code character varying(255) DEFAULT 'en'::character varying NOT NULL, visible boolean DEFAULT true NOT NULL, - body_format format_enum DEFAULT 'html'::format_enum NOT NULL + body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL ); @@ -684,7 +684,7 @@ CREATE TABLE messages ( to_user_id bigint NOT NULL, to_user_visible boolean DEFAULT true NOT NULL, from_user_visible boolean DEFAULT true NOT NULL, - body_format format_enum DEFAULT 'html'::format_enum NOT NULL + body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL ); @@ -741,7 +741,7 @@ CREATE TABLE nodes ( -- CREATE TABLE note_comments ( - id bigint NOT NULL, + id integer NOT NULL, note_id bigint NOT NULL, visible boolean NOT NULL, created_at timestamp without time zone NOT NULL, @@ -776,7 +776,7 @@ ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id; -- CREATE TABLE notes ( - id bigint NOT NULL, + id integer NOT NULL, latitude integer NOT NULL, longitude integer NOT NULL, tile bigint NOT NULL, @@ -894,8 +894,8 @@ CREATE TABLE redactions ( id integer NOT NULL, title character varying(255), description text, - created_at timestamp without time zone, - updated_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, user_id bigint NOT NULL, description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL ); @@ -983,7 +983,7 @@ CREATE TABLE user_blocks ( revoker_id bigint, created_at timestamp without time zone, updated_at timestamp without time zone, - reason_format format_enum DEFAULT 'html'::format_enum NOT NULL + reason_format format_enum DEFAULT 'markdown'::format_enum NOT NULL ); @@ -1107,10 +1107,10 @@ CREATE TABLE users ( status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL, terms_agreed timestamp without time zone, consider_pd boolean DEFAULT false NOT NULL, - openid_url character varying(255), preferred_editor character varying(255), terms_seen boolean DEFAULT false NOT NULL, - description_format format_enum DEFAULT 'html'::format_enum NOT NULL, + openid_url character varying(255), + description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL, image_fingerprint character varying(255), changesets_count integer DEFAULT 0 NOT NULL, traces_count integer DEFAULT 0 NOT NULL, @@ -1795,6 +1795,13 @@ CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id); CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility); +-- +-- Name: index_changeset_comments_on_body; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_changeset_comments_on_body ON changeset_comments USING btree (body); + + -- -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: -- @@ -2541,6 +2548,10 @@ INSERT INTO schema_migrations (version) VALUES ('20140507110937'); INSERT INTO schema_migrations (version) VALUES ('20140519141742'); +INSERT INTO schema_migrations (version) VALUES ('20150110152606'); + +INSERT INTO schema_migrations (version) VALUES ('20150111192335'); + INSERT INTO schema_migrations (version) VALUES ('21'); INSERT INTO schema_migrations (version) VALUES ('22'); -- 2.43.2