From e8780a18d8797f344c9abb91863e84c8e98f98e5 Mon Sep 17 00:00:00 2001 From: James Champ Date: Fri, 6 Aug 2021 14:57:20 -0400 Subject: [PATCH 1/2] Remove DDl from dev DB dump file --- scripts/dev-instance/dev_db.pg_dump | 136 ---------------------------- 1 file changed, 136 deletions(-) diff --git a/scripts/dev-instance/dev_db.pg_dump b/scripts/dev-instance/dev_db.pg_dump index 3cb4ef745a1..8e25f94840b 100644 --- a/scripts/dev-instance/dev_db.pg_dump +++ b/scripts/dev-instance/dev_db.pg_dump @@ -128,32 +128,12 @@ ALTER TABLE public.author_str OWNER TO openlibrary; -- Name: bookshelves; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- -CREATE TABLE public.bookshelves ( - id integer NOT NULL, - name text, - description text, - archived boolean DEFAULT false, - updated timestamp without time zone DEFAULT timezone('utc'::text, now()), - created timestamp without time zone DEFAULT timezone('utc'::text, now()) -); - - ALTER TABLE public.bookshelves OWNER TO postgres; -- -- Name: bookshelves_books; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- -CREATE TABLE public.bookshelves_books ( - username text NOT NULL, - work_id integer NOT NULL, - bookshelf_id integer NOT NULL, - edition_id integer, - updated timestamp without time zone DEFAULT timezone('utc'::text, now()), - created timestamp without time zone DEFAULT timezone('utc'::text, now()) -); - - ALTER TABLE public.bookshelves_books OWNER TO postgres; -- @@ -181,14 +161,6 @@ ALTER SEQUENCE public.bookshelves_id_seq OWNED BY public.bookshelves.id; -- Name: bookshelves_votes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- -CREATE TABLE public.bookshelves_votes ( - username text NOT NULL, - bookshelf_id integer NOT NULL, - updated timestamp without time zone DEFAULT timezone('utc'::text, now()), - created timestamp without time zone DEFAULT timezone('utc'::text, now()) -); - - ALTER TABLE public.bookshelves_votes OWNER TO postgres; -- @@ -428,16 +400,6 @@ ALTER TABLE public.publisher_str OWNER TO openlibrary; -- Name: ratings; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- -CREATE TABLE public.ratings ( - username text NOT NULL, - work_id integer NOT NULL, - rating integer, - edition_id integer, - updated timestamp without time zone DEFAULT timezone('utc'::text, now()), - created timestamp without time zone DEFAULT timezone('utc'::text, now()) -); - - ALTER TABLE public.ratings OWNER TO postgres; -- @@ -977,20 +939,6 @@ CREATE TABLE public.work_str ( ALTER TABLE public.work_str OWNER TO openlibrary; --- --- Name: id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.bookshelves ALTER COLUMN id SET DEFAULT nextval('public.bookshelves_id_seq'::regclass); - - --- --- Name: bookshelf_id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.bookshelves_votes ALTER COLUMN bookshelf_id SET DEFAULT nextval('public.bookshelves_votes_bookshelf_id_seq'::regclass); - - -- -- Name: id; Type: DEFAULT; Schema: public; Owner: openlibrary -- @@ -1317,25 +1265,6 @@ COPY public.author_str (thing_id, key_id, value, ordering) FROM stdin; \. --- --- Data for Name: bookshelves; Type: TABLE DATA; Schema: public; Owner: postgres --- - -COPY public.bookshelves (id, name, description, archived, updated, created) FROM stdin; -1 Want to Read A list of books I want to read f 2020-11-19 03:39:09.603171 2020-11-19 03:39:09.603171 -2 Currently Reading A list of books I am currently reading f 2020-11-19 03:39:09.60446 2020-11-19 03:39:09.60446 -3 Already Read A list of books I have finished reading f 2020-11-19 03:39:09.605349 2020-11-19 03:39:09.605349 -\. - - --- --- Data for Name: bookshelves_books; Type: TABLE DATA; Schema: public; Owner: postgres --- - -COPY public.bookshelves_books (username, work_id, bookshelf_id, edition_id, updated, created) FROM stdin; -\. - - -- -- Name: bookshelves_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- @@ -1343,14 +1272,6 @@ COPY public.bookshelves_books (username, work_id, bookshelf_id, edition_id, upda SELECT pg_catalog.setval('public.bookshelves_id_seq', 3, true); --- --- Data for Name: bookshelves_votes; Type: TABLE DATA; Schema: public; Owner: postgres --- - -COPY public.bookshelves_votes (username, bookshelf_id, updated, created) FROM stdin; -\. - - -- -- Name: bookshelves_votes_bookshelf_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- @@ -4948,15 +4869,6 @@ COPY public.publisher_ref (thing_id, key_id, value, ordering) FROM stdin; COPY public.publisher_str (thing_id, key_id, value, ordering) FROM stdin; \. - --- --- Data for Name: ratings; Type: TABLE DATA; Schema: public; Owner: postgres --- - -COPY public.ratings (username, work_id, rating, edition_id, updated, created) FROM stdin; -\. - - -- -- Data for Name: scan_boolean; Type: TABLE DATA; Schema: public; Owner: openlibrary -- @@ -7740,30 +7652,6 @@ ALTER TABLE ONLY public.account ADD CONSTRAINT account_email_key UNIQUE (email); --- --- Name: bookshelves_books_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY public.bookshelves_books - ADD CONSTRAINT bookshelves_books_pkey PRIMARY KEY (username, work_id, bookshelf_id); - - --- --- Name: bookshelves_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY public.bookshelves - ADD CONSTRAINT bookshelves_pkey PRIMARY KEY (id); - - --- --- Name: bookshelves_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY public.bookshelves_votes - ADD CONSTRAINT bookshelves_votes_pkey PRIMARY KEY (username, bookshelf_id); - - -- -- Name: property_pkey; Type: CONSTRAINT; Schema: public; Owner: openlibrary; Tablespace: -- @@ -7780,14 +7668,6 @@ ALTER TABLE ONLY public.property ADD CONSTRAINT property_type_name_key UNIQUE (type, name); --- --- Name: ratings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY public.ratings - ADD CONSTRAINT ratings_pkey PRIMARY KEY (username, work_id); - - -- -- Name: seq_name_key; Type: CONSTRAINT; Schema: public; Owner: openlibrary; Tablespace: -- @@ -8528,22 +8408,6 @@ ALTER TABLE ONLY public.author_str ADD CONSTRAINT author_str_thing_id_fkey FOREIGN KEY (thing_id) REFERENCES public.thing(id); --- --- Name: bookshelves_books_bookshelf_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.bookshelves_books - ADD CONSTRAINT bookshelves_books_bookshelf_id_fkey FOREIGN KEY (bookshelf_id) REFERENCES public.bookshelves(id) ON UPDATE CASCADE ON DELETE CASCADE; - - --- --- Name: bookshelves_votes_bookshelf_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.bookshelves_votes - ADD CONSTRAINT bookshelves_votes_bookshelf_id_fkey FOREIGN KEY (bookshelf_id) REFERENCES public.bookshelves(id) ON UPDATE CASCADE ON DELETE CASCADE; - - -- -- Name: data_thing_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: openlibrary -- From 77e0a1ee7063375f41db44cb492809410a927ee8 Mon Sep 17 00:00:00 2001 From: James Champ Date: Fri, 6 Aug 2021 15:51:56 -0400 Subject: [PATCH 2/2] Remove redundant sequences --- scripts/dev-instance/dev_db.pg_dump | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/scripts/dev-instance/dev_db.pg_dump b/scripts/dev-instance/dev_db.pg_dump index 8e25f94840b..0da6877d6fc 100644 --- a/scripts/dev-instance/dev_db.pg_dump +++ b/scripts/dev-instance/dev_db.pg_dump @@ -140,14 +140,6 @@ ALTER TABLE public.bookshelves_books OWNER TO postgres; -- Name: bookshelves_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- -CREATE SEQUENCE public.bookshelves_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - ALTER TABLE public.bookshelves_id_seq OWNER TO postgres; -- @@ -167,16 +159,9 @@ ALTER TABLE public.bookshelves_votes OWNER TO postgres; -- Name: bookshelves_votes_bookshelf_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- -CREATE SEQUENCE public.bookshelves_votes_bookshelf_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - ALTER TABLE public.bookshelves_votes_bookshelf_id_seq OWNER TO postgres; + -- -- Name: bookshelves_votes_bookshelf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --