/
Renonr
/
SpringProject
Обзор
Документация
Войти
/
Renonr
/
SpringProject
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
Spring_Branch
dump.sql
756 строк
18 KB
Renonr
My first commit
13 фев 2025, 01:35
13 фев 2025, 01:35
5887b11
Код
Авторство
О чём код?
-- -- PostgreSQL database dump -- -- Dumped from database version 17.2 -- Dumped by pg_dump version 17.2 SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; -- SET transaction_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; -- -- Name: cart_items; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.cart_items ( id integer NOT NULL, user_id integer, product_id integer, quantity integer NOT NULL, CONSTRAINT cart_items_quantity_check CHECK ((quantity > 0)) ); ALTER TABLE public.cart_items OWNER TO postgres; -- -- Name: cart_items_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.cart_items_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.cart_items_id_seq OWNER TO postgres; -- -- Name: cart_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.cart_items_id_seq OWNED BY public.cart_items.id; -- -- Name: categories; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.categories ( id integer NOT NULL, name character varying(100) NOT NULL, parent_id integer ); ALTER TABLE public.categories OWNER TO postgres; -- -- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.categories_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.categories_id_seq OWNER TO postgres; -- -- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.categories_id_seq OWNED BY public.categories.id; -- -- Name: flyway_schema_history; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.flyway_schema_history ( installed_rank integer NOT NULL, version character varying(50), description character varying(200) NOT NULL, type character varying(20) NOT NULL, script character varying(1000) NOT NULL, checksum integer, installed_by character varying(100) NOT NULL, installed_on timestamp without time zone DEFAULT now() NOT NULL, execution_time integer NOT NULL, success boolean NOT NULL ); ALTER TABLE public.flyway_schema_history OWNER TO postgres; -- -- Name: order_items; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.order_items ( id integer NOT NULL, order_id integer, product_id integer, quantity integer NOT NULL, price numeric(10,2) NOT NULL, CONSTRAINT order_items_quantity_check CHECK ((quantity > 0)) ); ALTER TABLE public.order_items OWNER TO postgres; -- -- Name: order_items_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.order_items_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.order_items_id_seq OWNER TO postgres; -- -- Name: order_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.order_items_id_seq OWNED BY public.order_items.id; -- -- Name: orders; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.orders ( id integer NOT NULL, user_id integer, total_amount numeric(10,2) NOT NULL, created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, total_price numeric(19,2) NOT NULL ); ALTER TABLE public.orders OWNER TO postgres; -- -- Name: orders_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.orders_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.orders_id_seq OWNER TO postgres; -- -- Name: orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.orders_id_seq OWNED BY public.orders.id; -- -- Name: product_attributes; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.product_attributes ( id integer NOT NULL, product_id integer, attribute_name character varying(100) NOT NULL, attribute_value character varying(255) NOT NULL ); ALTER TABLE public.product_attributes OWNER TO postgres; -- -- Name: product_attributes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.product_attributes_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.product_attributes_id_seq OWNER TO postgres; -- -- Name: product_attributes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.product_attributes_id_seq OWNED BY public.product_attributes.id; -- -- Name: product_categories; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.product_categories ( product_id bigint NOT NULL, category_id bigint NOT NULL ); ALTER TABLE public.product_categories OWNER TO postgres; -- -- Name: products; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.products ( id integer NOT NULL, name character varying(255) NOT NULL, description text, price numeric(10,2) NOT NULL, stock integer NOT NULL, image_url character varying(255), discount_price numeric(19,2), rating double precision, CONSTRAINT products_stock_check CHECK ((stock >= 0)) ); ALTER TABLE public.products OWNER TO postgres; -- -- Name: products_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.products_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.products_id_seq OWNER TO postgres; -- -- Name: products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.products_id_seq OWNED BY public.products.id; -- -- Name: reviews; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.reviews ( id integer NOT NULL, user_id integer, product_id integer, rating integer NOT NULL, comment text, image_url character varying(255), created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, CONSTRAINT reviews_rating_check CHECK (((rating >= 1) AND (rating <= 5))) ); ALTER TABLE public.reviews OWNER TO postgres; -- -- Name: reviews_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.reviews_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.reviews_id_seq OWNER TO postgres; -- -- Name: reviews_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.reviews_id_seq OWNED BY public.reviews.id; -- -- Name: users; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.users ( id integer NOT NULL, first_name character varying(50) NOT NULL, last_name character varying(50) NOT NULL, email character varying(100) NOT NULL, password character varying(255) NOT NULL, role character varying(10) DEFAULT 'USER'::character varying NOT NULL, CONSTRAINT users_role_check CHECK (((role)::text = ANY ((ARRAY['USER'::character varying, 'ADMIN'::character varying])::text[]))) ); ALTER TABLE public.users OWNER TO postgres; -- -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.users_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.users_id_seq OWNER TO postgres; -- -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; -- -- Name: cart_items id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.cart_items ALTER COLUMN id SET DEFAULT nextval('public.cart_items_id_seq'::regclass); -- -- Name: categories id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.categories ALTER COLUMN id SET DEFAULT nextval('public.categories_id_seq'::regclass); -- -- Name: order_items id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.order_items ALTER COLUMN id SET DEFAULT nextval('public.order_items_id_seq'::regclass); -- -- Name: orders id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.orders ALTER COLUMN id SET DEFAULT nextval('public.orders_id_seq'::regclass); -- -- Name: product_attributes id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.product_attributes ALTER COLUMN id SET DEFAULT nextval('public.product_attributes_id_seq'::regclass); -- -- Name: products id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.products ALTER COLUMN id SET DEFAULT nextval('public.products_id_seq'::regclass); -- -- Name: reviews id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.reviews ALTER COLUMN id SET DEFAULT nextval('public.reviews_id_seq'::regclass); -- -- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- -- Data for Name: cart_items; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.cart_items (id, user_id, product_id, quantity) FROM stdin; \. -- -- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.categories (id, name, parent_id) FROM stdin; 1 Смартфоны \N 2 Ноутбуки \N 3 Аксессуары \N 4 Телевизоры \N 5 Игровые приставки \N \. -- -- Data for Name: flyway_schema_history; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.flyway_schema_history (installed_rank, version, description, type, script, checksum, installed_by, installed_on, execution_time, success) FROM stdin; 1 1 << Flyway Baseline >> BASELINE << Flyway Baseline >> \N null 2025-02-11 01:04:49.901152 0 t \. -- -- Data for Name: order_items; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.order_items (id, order_id, product_id, quantity, price) FROM stdin; \. -- -- Data for Name: orders; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.orders (id, user_id, total_amount, created_at, total_price) FROM stdin; \. -- -- Data for Name: product_attributes; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.product_attributes (id, product_id, attribute_name, attribute_value) FROM stdin; \. -- -- Data for Name: product_categories; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.product_categories (product_id, category_id) FROM stdin; \. -- -- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.products (id, name, description, price, stock, image_url, discount_price, rating) FROM stdin; 1 iPhone 14 Флагман Apple 999.99 10 iphone14.jpg \N \N 2 Samsung Galaxy S22 Флагман Samsung 899.99 15 galaxy_s22.jpg \N \N 3 MacBook Pro Мощный ноутбук Apple 1999.99 5 macbook.jpg \N \N 4 Dell XPS 15 Ноутбук для работы 1599.99 8 dell_xps15.jpg \N \N 5 PlayStation 5 Игровая консоль Sony 499.99 20 ps5.jpg \N \N \. -- -- Data for Name: reviews; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.reviews (id, user_id, product_id, rating, comment, image_url, created_at) FROM stdin; \. -- -- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.users (id, first_name, last_name, email, password, role) FROM stdin; 1 Admin User admin@example.com admin123 ADMIN 2 John Doe john@example.com password123 USER 3 Jane Smith jane@example.com password123 USER 4 Alice Johnson alice@example.com password123 USER 5 Bob Williams bob@example.com password123 USER \. -- -- Name: cart_items_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.cart_items_id_seq', 1, false); -- -- Name: categories_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.categories_id_seq', 5, true); -- -- Name: order_items_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.order_items_id_seq', 1, false); -- -- Name: orders_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.orders_id_seq', 1, false); -- -- Name: product_attributes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.product_attributes_id_seq', 1, false); -- -- Name: products_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.products_id_seq', 5, true); -- -- Name: reviews_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.reviews_id_seq', 1, false); -- -- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.users_id_seq', 5, true); -- -- Name: cart_items cart_items_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.cart_items ADD CONSTRAINT cart_items_pkey PRIMARY KEY (id); -- -- Name: categories categories_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.categories ADD CONSTRAINT categories_name_key UNIQUE (name); -- -- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.categories ADD CONSTRAINT categories_pkey PRIMARY KEY (id); -- -- Name: flyway_schema_history flyway_schema_history_pk; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.flyway_schema_history ADD CONSTRAINT flyway_schema_history_pk PRIMARY KEY (installed_rank); -- -- Name: order_items order_items_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.order_items ADD CONSTRAINT order_items_pkey PRIMARY KEY (id); -- -- Name: orders orders_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.orders ADD CONSTRAINT orders_pkey PRIMARY KEY (id); -- -- Name: product_attributes product_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.product_attributes ADD CONSTRAINT product_attributes_pkey PRIMARY KEY (id); -- -- Name: product_categories product_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.product_categories ADD CONSTRAINT product_categories_pkey PRIMARY KEY (product_id, category_id); -- -- Name: products products_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.products ADD CONSTRAINT products_pkey PRIMARY KEY (id); -- -- Name: reviews reviews_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.reviews ADD CONSTRAINT reviews_pkey PRIMARY KEY (id); -- -- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users ADD CONSTRAINT users_email_key UNIQUE (email); -- -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users ADD CONSTRAINT users_pkey PRIMARY KEY (id); -- -- Name: flyway_schema_history_s_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX flyway_schema_history_s_idx ON public.flyway_schema_history USING btree (success); -- -- Name: cart_items cart_items_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.cart_items ADD CONSTRAINT cart_items_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.products(id) ON DELETE CASCADE; -- -- Name: cart_items cart_items_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.cart_items ADD CONSTRAINT cart_items_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; -- -- Name: categories categories_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.categories ADD CONSTRAINT categories_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.categories(id) ON DELETE SET NULL; -- -- Name: product_categories fkd112rx0alycddsms029iifrih; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.product_categories ADD CONSTRAINT fkd112rx0alycddsms029iifrih FOREIGN KEY (category_id) REFERENCES public.categories(id); -- -- Name: product_categories fklda9rad6s180ha3dl1ncsp8n7; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.product_categories ADD CONSTRAINT fklda9rad6s180ha3dl1ncsp8n7 FOREIGN KEY (product_id) REFERENCES public.products(id); -- -- Name: order_items order_items_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.order_items ADD CONSTRAINT order_items_order_id_fkey FOREIGN KEY (order_id) REFERENCES public.orders(id) ON DELETE CASCADE; -- -- Name: order_items order_items_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.order_items ADD CONSTRAINT order_items_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.products(id) ON DELETE CASCADE; -- -- Name: orders orders_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.orders ADD CONSTRAINT orders_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; -- -- Name: product_attributes product_attributes_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.product_attributes ADD CONSTRAINT product_attributes_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.products(id) ON DELETE CASCADE; -- -- Name: reviews reviews_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.reviews ADD CONSTRAINT reviews_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.products(id) ON DELETE CASCADE; -- -- Name: reviews reviews_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.reviews ADD CONSTRAINT reviews_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; -- -- PostgreSQL database dump complete --