Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- PostgreSQL database dump
- --
- -- Dumped from database version 9.5.6
- -- Dumped by pg_dump version 9.5.6
- -- Started on 2018-09-17 16:55:31
- SET statement_timeout = 0;
- SET lock_timeout = 0;
- SET client_encoding = 'UTF8';
- SET standard_conforming_strings = on;
- SET check_function_bodies = false;
- SET client_min_messages = warning;
- SET row_security = off;
- --
- -- TOC entry 1 (class 3079 OID 12355)
- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
- --
- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
- --
- -- TOC entry 2169 (class 0 OID 0)
- -- Dependencies: 1
- -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
- --
- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
- SET search_path = public, pg_catalog;
- --
- -- TOC entry 185 (class 1259 OID 50711)
- -- Name: basket_id_basket_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE basket_id_basket_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- MAXVALUE 1000000000
- CACHE 1;
- ALTER TABLE basket_id_basket_seq OWNER TO postgres;
- SET default_tablespace = '';
- SET default_with_oids = false;
- --
- -- TOC entry 186 (class 1259 OID 50713)
- -- Name: basket; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE basket (
- basket_id integer DEFAULT nextval('basket_id_basket_seq'::regclass) NOT NULL,
- user_id integer NOT NULL,
- total_cost integer NOT NULL
- );
- ALTER TABLE basket OWNER TO postgres;
- --
- -- TOC entry 183 (class 1259 OID 50703)
- -- Name: product_id_product_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE product_id_product_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- MAXVALUE 1000000000
- CACHE 1;
- ALTER TABLE product_id_product_seq OWNER TO postgres;
- --
- -- TOC entry 184 (class 1259 OID 50705)
- -- Name: product; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE product (
- product_id integer DEFAULT nextval('product_id_product_seq'::regclass) NOT NULL,
- name character varying(50) NOT NULL,
- cost integer NOT NULL,
- category character varying(50) NOT NULL
- );
- ALTER TABLE product OWNER TO postgres;
- --
- -- TOC entry 191 (class 1259 OID 75342)
- -- Name: product_to_basket_id_product_to_basket_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE product_to_basket_id_product_to_basket_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE product_to_basket_id_product_to_basket_seq OWNER TO postgres;
- --
- -- TOC entry 192 (class 1259 OID 75347)
- -- Name: product_to_basket; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE product_to_basket (
- id_product_to_basket integer DEFAULT nextval('product_to_basket_id_product_to_basket_seq'::regclass) NOT NULL,
- basket_id integer NOT NULL,
- product_id integer NOT NULL
- );
- ALTER TABLE product_to_basket OWNER TO postgres;
- --
- -- TOC entry 187 (class 1259 OID 50756)
- -- Name: role_id_role_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE role_id_role_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE role_id_role_seq OWNER TO postgres;
- --
- -- TOC entry 188 (class 1259 OID 50758)
- -- Name: role; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE role (
- role_id integer DEFAULT nextval('role_id_role_seq'::regclass) NOT NULL,
- role_name character varying(50) NOT NULL
- );
- ALTER TABLE role OWNER TO postgres;
- --
- -- TOC entry 181 (class 1259 OID 50693)
- -- Name: user_account_id_user_account_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE user_account_id_user_account_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- MAXVALUE 10000000
- CACHE 1;
- ALTER TABLE user_account_id_user_account_seq OWNER TO postgres;
- --
- -- TOC entry 182 (class 1259 OID 50695)
- -- Name: user_account; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE user_account (
- user_id integer DEFAULT nextval('user_account_id_user_account_seq'::regclass) NOT NULL,
- name character varying(50) NOT NULL,
- password character varying(50) NOT NULL,
- email character varying(50) NOT NULL
- );
- ALTER TABLE user_account OWNER TO postgres;
- --
- -- TOC entry 190 (class 1259 OID 50766)
- -- Name: user_account_to_role; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE user_account_to_role (
- id_user_to_roles integer NOT NULL,
- user_id integer NOT NULL,
- role_id integer NOT NULL
- );
- ALTER TABLE user_account_to_role OWNER TO postgres;
- --
- -- TOC entry 189 (class 1259 OID 50764)
- -- Name: user_account_to_role_id_user_account_to_role_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE user_account_to_role_id_user_account_to_role_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE user_account_to_role_id_user_account_to_role_seq OWNER TO postgres;
- --
- -- TOC entry 2170 (class 0 OID 0)
- -- Dependencies: 189
- -- Name: user_account_to_role_id_user_account_to_role_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE user_account_to_role_id_user_account_to_role_seq OWNED BY user_account_to_role.id_user_to_roles;
- --
- -- TOC entry 2015 (class 2604 OID 50769)
- -- Name: id_user_to_roles; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY user_account_to_role ALTER COLUMN id_user_to_roles SET DEFAULT nextval('user_account_to_role_id_user_account_to_role_seq'::regclass);
- --
- -- TOC entry 2155 (class 0 OID 50713)
- -- Dependencies: 186
- -- Data for Name: basket; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY basket (basket_id, user_id, total_cost) FROM stdin;
- \.
- --
- -- TOC entry 2171 (class 0 OID 0)
- -- Dependencies: 185
- -- Name: basket_id_basket_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('basket_id_basket_seq', 1, false);
- --
- -- TOC entry 2153 (class 0 OID 50705)
- -- Dependencies: 184
- -- Data for Name: product; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY product (product_id, name, cost, category) FROM stdin;
- \.
- --
- -- TOC entry 2172 (class 0 OID 0)
- -- Dependencies: 183
- -- Name: product_id_product_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('product_id_product_seq', 1, false);
- --
- -- TOC entry 2161 (class 0 OID 75347)
- -- Dependencies: 192
- -- Data for Name: product_to_basket; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY product_to_basket (id_product_to_basket, basket_id, product_id) FROM stdin;
- \.
- --
- -- TOC entry 2173 (class 0 OID 0)
- -- Dependencies: 191
- -- Name: product_to_basket_id_product_to_basket_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('product_to_basket_id_product_to_basket_seq', 1, false);
- --
- -- TOC entry 2157 (class 0 OID 50758)
- -- Dependencies: 188
- -- Data for Name: role; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY role (role_id, role_name) FROM stdin;
- 1 USER
- \.
- --
- -- TOC entry 2174 (class 0 OID 0)
- -- Dependencies: 187
- -- Name: role_id_role_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('role_id_role_seq', 1, true);
- --
- -- TOC entry 2151 (class 0 OID 50695)
- -- Dependencies: 182
- -- Data for Name: user_account; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY user_account (user_id, name, password, email) FROM stdin;
- 4 userName userPassword userEmail
- \.
- --
- -- TOC entry 2175 (class 0 OID 0)
- -- Dependencies: 181
- -- Name: user_account_id_user_account_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('user_account_id_user_account_seq', 4, true);
- --
- -- TOC entry 2159 (class 0 OID 50766)
- -- Dependencies: 190
- -- Data for Name: user_account_to_role; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY user_account_to_role (id_user_to_roles, user_id, role_id) FROM stdin;
- 1 4 1
- \.
- --
- -- TOC entry 2176 (class 0 OID 0)
- -- Dependencies: 189
- -- Name: user_account_to_role_id_user_account_to_role_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('user_account_to_role_id_user_account_to_role_seq', 1, true);
- --
- -- TOC entry 2024 (class 2606 OID 50718)
- -- Name: baskets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY basket
- ADD CONSTRAINT baskets_pkey PRIMARY KEY (basket_id);
- --
- -- TOC entry 2030 (class 2606 OID 75352)
- -- Name: product_to_basket_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY product_to_basket
- ADD CONSTRAINT product_to_basket_pkey PRIMARY KEY (id_product_to_basket);
- --
- -- TOC entry 2022 (class 2606 OID 50710)
- -- Name: products_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY product
- ADD CONSTRAINT products_pkey PRIMARY KEY (product_id);
- --
- -- TOC entry 2026 (class 2606 OID 50763)
- -- Name: roles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY role
- ADD CONSTRAINT roles_pkey PRIMARY KEY (role_id);
- --
- -- TOC entry 2018 (class 2606 OID 50702)
- -- Name: users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY user_account
- ADD CONSTRAINT users_email_key UNIQUE (email);
- --
- -- TOC entry 2020 (class 2606 OID 50700)
- -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY user_account
- ADD CONSTRAINT users_pkey PRIMARY KEY (user_id);
- --
- -- TOC entry 2028 (class 2606 OID 50771)
- -- Name: users_to_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY user_account_to_role
- ADD CONSTRAINT users_to_roles_pkey PRIMARY KEY (id_user_to_roles);
- --
- -- TOC entry 2035 (class 2606 OID 75358)
- -- Name: basket_to_product_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY product_to_basket
- ADD CONSTRAINT basket_to_product_fkey FOREIGN KEY (basket_id) REFERENCES basket(basket_id);
- --
- -- TOC entry 2031 (class 2606 OID 50719)
- -- Name: baskets_to_users_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY basket
- ADD CONSTRAINT baskets_to_users_id_fkey FOREIGN KEY (user_id) REFERENCES user_account(user_id);
- --
- -- TOC entry 2034 (class 2606 OID 75353)
- -- Name: product_to_basket_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY product_to_basket
- ADD CONSTRAINT product_to_basket_fkey FOREIGN KEY (product_id) REFERENCES product(product_id);
- --
- -- TOC entry 2033 (class 2606 OID 50777)
- -- Name: roles_to_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY user_account_to_role
- ADD CONSTRAINT roles_to_users_fkey FOREIGN KEY (role_id) REFERENCES role(role_id);
- --
- -- TOC entry 2032 (class 2606 OID 50772)
- -- Name: users_to_roles_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY user_account_to_role
- ADD CONSTRAINT users_to_roles_fkey FOREIGN KEY (user_id) REFERENCES user_account(user_id);
- --
- -- TOC entry 2168 (class 0 OID 0)
- -- Dependencies: 6
- -- Name: public; Type: ACL; Schema: -; Owner: postgres
- --
- REVOKE ALL ON SCHEMA public FROM PUBLIC;
- REVOKE ALL ON SCHEMA public FROM postgres;
- GRANT ALL ON SCHEMA public TO postgres;
- GRANT ALL ON SCHEMA public TO PUBLIC;
- -- Completed on 2018-09-17 16:55:33
- --
- -- PostgreSQL database dump complete
- --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement