]> git.openstreetmap.org Git - rails.git/blobdiff - db/structure.sql
Use options_for_select to set the selected items in the search form
[rails.git] / db / structure.sql
index be0603e6ea299927e23c3b2140ccdbb39fd1ee5f..73cb543e7688c3133825caf98232bfd4ed3ff34d 100644 (file)
@@ -66,6 +66,17 @@ CREATE TYPE gpx_visibility_enum AS ENUM (
 );
 
 
+--
+-- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
+--
+
+CREATE TYPE issue_status_enum AS ENUM (
+    'open',
+    'ignored',
+    'resolved'
+);
+
+
 --
 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
 --
@@ -691,11 +702,10 @@ ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
 
 CREATE TABLE issue_comments (
     id integer NOT NULL,
-    issue_id integer,
-    commenter_user_id integer,
-    body text,
+    issue_id integer NOT NULL,
+    user_id integer NOT NULL,
+    body text NOT NULL,
     created_at timestamp without time zone NOT NULL,
-    reassign boolean,
     updated_at timestamp without time zone NOT NULL
 );
 
@@ -727,15 +737,15 @@ CREATE TABLE issues (
     id integer NOT NULL,
     reportable_type character varying NOT NULL,
     reportable_id integer NOT NULL,
-    reported_user_id integer NOT NULL,
-    status integer,
-    issue_type character varying,
+    reported_user_id integer,
+    status issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
+    assigned_role user_role_enum NOT NULL,
     resolved_at timestamp without time zone,
     resolved_by integer,
-    created_at timestamp without time zone NOT NULL,
-    updated_at timestamp without time zone NOT NULL,
     updated_by integer,
-    report_count integer DEFAULT 0
+    reports_count integer DEFAULT 0,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
 );
 
 
@@ -1065,9 +1075,10 @@ CREATE TABLE relations (
 
 CREATE TABLE reports (
     id integer NOT NULL,
-    issue_id integer,
-    reporter_user_id integer,
-    details text,
+    issue_id integer NOT NULL,
+    user_id integer NOT NULL,
+    details text NOT NULL,
+    category character varying NOT NULL,
     created_at timestamp without time zone NOT NULL,
     updated_at timestamp without time zone NOT NULL
 );
@@ -2032,24 +2043,24 @@ CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON diary_entry_su
 
 
 --
--- Name: index_issue_comments_on_commenter_user_id; Type: INDEX; Schema: public; Owner: -
+-- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
 --
 
-CREATE INDEX index_issue_comments_on_commenter_user_id ON issue_comments USING btree (commenter_user_id);
+CREATE INDEX index_issue_comments_on_issue_id ON issue_comments USING btree (issue_id);
 
 
 --
--- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
+-- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
 --
 
-CREATE INDEX index_issue_comments_on_issue_id ON issue_comments USING btree (issue_id);
+CREATE INDEX index_issue_comments_on_user_id ON issue_comments USING btree (user_id);
 
 
 --
--- Name: index_issues_on_reportable_id_and_reportable_type; Type: INDEX; Schema: public; Owner: -
+-- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
 --
 
-CREATE INDEX index_issues_on_reportable_id_and_reportable_type ON issues USING btree (reportable_id, reportable_type);
+CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON issues USING btree (reportable_type, reportable_id);
 
 
 --
@@ -2109,10 +2120,10 @@ CREATE INDEX index_reports_on_issue_id ON reports USING btree (issue_id);
 
 
 --
--- Name: index_reports_on_reporter_user_id; Type: INDEX; Schema: public; Owner: -
+-- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
 --
 
-CREATE INDEX index_reports_on_reporter_user_id ON reports USING btree (reporter_user_id);
+CREATE INDEX index_reports_on_user_id ON reports USING btree (user_id);
 
 
 --
@@ -2528,19 +2539,19 @@ ALTER TABLE ONLY gpx_files
 
 
 --
--- Name: issue_comments_commenter_user_id; Type: FK CONSTRAINT; Schema: public; Owner: -
+-- Name: issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
 --
 
 ALTER TABLE ONLY issue_comments
-    ADD CONSTRAINT issue_comments_commenter_user_id FOREIGN KEY (commenter_user_id) REFERENCES users(id) ON DELETE CASCADE;
+    ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
 
 
 --
--- Name: issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
+-- Name: issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
 --
 
 ALTER TABLE ONLY issue_comments
-    ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+    ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
 
 
 --
@@ -2548,7 +2559,15 @@ ALTER TABLE ONLY issue_comments
 --
 
 ALTER TABLE ONLY issues
-    ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES users(id) ON DELETE CASCADE;
+    ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES users(id);
+
+
+--
+-- Name: issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY issues
+    ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES users(id);
 
 
 --
@@ -2556,7 +2575,7 @@ ALTER TABLE ONLY issues
 --
 
 ALTER TABLE ONLY issues
-    ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES users(id) ON DELETE CASCADE;
+    ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES users(id);
 
 
 --
@@ -2676,15 +2695,15 @@ ALTER TABLE ONLY relations
 --
 
 ALTER TABLE ONLY reports
-    ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+    ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
 
 
 --
--- Name: reports_reporter_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
+-- Name: reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
 --
 
 ALTER TABLE ONLY reports
-    ADD CONSTRAINT reports_reporter_user_id_fkey FOREIGN KEY (reporter_user_id) REFERENCES users(id) ON DELETE CASCADE;
+    ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
 
 
 --
@@ -2831,8 +2850,6 @@ INSERT INTO "schema_migrations" (version) VALUES
 ('20150222101847'),
 ('20150818224516'),
 ('20160822153055'),
-('20160822153115'),
-('20160822153153'),
 ('20161002153425'),
 ('20161011010929'),
 ('20170222134109'),
@@ -2880,3 +2897,5 @@ INSERT INTO "schema_migrations" (version) VALUES
 ('7'),
 ('8'),
 ('9');
+
+