add new model for post replacements, add undo functionality

This commit is contained in:
r888888888
2017-05-12 15:46:36 -07:00
parent dc02dcf0e0
commit 78b08d8394
5 changed files with 178 additions and 47 deletions

View File

@@ -2686,6 +2686,40 @@ CREATE SEQUENCE post_flags_id_seq
ALTER SEQUENCE post_flags_id_seq OWNED BY post_flags.id;
--
-- Name: post_replacements; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE post_replacements (
id integer NOT NULL,
post_id integer NOT NULL,
creator_id integer NOT NULL,
original_url text NOT NULL,
replacement_url text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: post_replacements_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE post_replacements_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: post_replacements_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE post_replacements_id_seq OWNED BY post_replacements.id;
--
-- Name: post_updates; Type: TABLE; Schema: public; Owner: -
--
@@ -4265,6 +4299,13 @@ ALTER TABLE ONLY post_disapprovals ALTER COLUMN id SET DEFAULT nextval('post_dis
ALTER TABLE ONLY post_flags ALTER COLUMN id SET DEFAULT nextval('post_flags_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY post_replacements ALTER COLUMN id SET DEFAULT nextval('post_replacements_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -4658,6 +4699,14 @@ ALTER TABLE ONLY post_flags
ADD CONSTRAINT post_flags_pkey PRIMARY KEY (id);
--
-- Name: post_replacements_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY post_replacements
ADD CONSTRAINT post_replacements_pkey PRIMARY KEY (id);
--
-- Name: post_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@@ -6780,6 +6829,20 @@ CREATE INDEX index_post_flags_on_post_id ON post_flags USING btree (post_id);
CREATE INDEX index_post_flags_on_reason_tsvector ON post_flags USING gin (to_tsvector('english'::regconfig, reason));
--
-- Name: index_post_replacements_on_creator_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_post_replacements_on_creator_id ON post_replacements USING btree (creator_id);
--
-- Name: index_post_replacements_on_post_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_post_replacements_on_post_id ON post_replacements USING btree (post_id);
--
-- Name: index_post_votes_on_post_id; Type: INDEX; Schema: public; Owner: -
--
@@ -7471,3 +7534,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170416224142');
INSERT INTO schema_migrations (version) VALUES ('20170428220448');
INSERT INTO schema_migrations (version) VALUES ('20170512221200');