CREATE TABLE issue_comments (
id integer NOT NULL,
- issue_id integer,
- commenter_user_id integer,
- body text,
- reassign boolean,
+ issue_id integer NOT NULL,
+ user_id integer NOT NULL,
+ body text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
id integer NOT NULL,
reportable_type character varying NOT NULL,
reportable_id integer NOT NULL,
- reported_user_id integer NOT NULL,
+ reported_user_id integer,
status integer,
- issue_type character varying,
+ assigned_role user_role_enum NOT NULL,
resolved_at timestamp without time zone,
resolved_by integer,
updated_by integer,
+ reports_count integer DEFAULT 0,
created_at timestamp without time zone NOT NULL,
- updated_at timestamp without time zone NOT NULL,
- report_count integer DEFAULT 0
+ updated_at timestamp without time zone NOT NULL
);
CREATE TABLE reports (
id integer NOT NULL,
issue_id integer,
- reporter_user_id integer,
- details text,
+ user_id integer,
+ 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
);
--
--- 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_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);
--
--
--- 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) ON DELETE CASCADE;
--
--- Name: issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
+-- Name: issue_comments_user_id; 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 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
--
--
--- 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) ON DELETE CASCADE;
--
('20150222101847'),
('20150818224516'),
('20160822153055'),
-('20160822153115'),
-('20160822153153'),
('20161002153425'),
('20161011010929'),
('20170222134109'),
('7'),
('8'),
('9');
+
+