Files
dolthub--doltgresql/testing/dumps/sql/KangAbbad_laundry-app.sql
T
2026-07-13 12:32:25 +08:00

614 lines
15 KiB
PL/PgSQL

-- Downloaded from: https://github.com/KangAbbad/laundry-app/blob/78b2c9c3724451e0c767014489eb3c101ef2dc3c/dump_.sql
--
-- PostgreSQL database cluster dump
--
SET default_transaction_read_only = off;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
--
-- Drop databases (except postgres and template1)
--
DROP DATABASE laundryapp;
--
-- Drop roles
--
DROP ROLE postgres;
--
-- Roles
--
CREATE ROLE postgres;
ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS PASSWORD 'SCRAM-SHA-256$4096:I68tB9pBDKM3OrgkD7901A==$hYxpQVMe6Tg+8NrcWCU/8zj/ZV8iin7CZjzT7QN1oUQ=:o+IZGdW7ixEUWk2NysrLj4xA/fHD31yIahmgdmmmkXY=';
--
-- Databases
--
--
-- Database "template1" dump
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.5 (Debian 14.5-1.pgdg110+1)
-- Dumped by pg_dump version 14.5 (Debian 14.5-1.pgdg110+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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;
UPDATE pg_catalog.pg_database SET datistemplate = false WHERE datname = 'template1';
DROP DATABASE template1;
--
-- Name: template1; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = 'en_US.utf8';
ALTER DATABASE template1 OWNER TO postgres;
\connect template1
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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: DATABASE template1; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON DATABASE template1 IS 'default template for new databases';
--
-- Name: template1; Type: DATABASE PROPERTIES; Schema: -; Owner: postgres
--
ALTER DATABASE template1 IS_TEMPLATE = true;
\connect template1
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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: DATABASE template1; Type: ACL; Schema: -; Owner: postgres
--
REVOKE CONNECT,TEMPORARY ON DATABASE template1 FROM PUBLIC;
GRANT CONNECT ON DATABASE template1 TO PUBLIC;
--
-- PostgreSQL database dump complete
--
--
-- Database "laundryapp" dump
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.5 (Debian 14.5-1.pgdg110+1)
-- Dumped by pg_dump version 14.5 (Debian 14.5-1.pgdg110+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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: laundryapp; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE laundryapp WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = 'en_US.utf8';
ALTER DATABASE laundryapp OWNER TO postgres;
\connect laundryapp
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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: today_revenue(); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.today_revenue() RETURNS TABLE(admin_id bigint, total_revenue numeric)
LANGUAGE plpgsql
AS $$
begin
return query select t.admin_id, sum(t.total_price) as total_revenue from transactions t where date(created_at) = current_date group by t.admin_id;
end
$$;
ALTER FUNCTION public.today_revenue() OWNER TO postgres;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: admin_roles; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.admin_roles (
admin_id bigint NOT NULL,
role_id bigint NOT NULL
);
ALTER TABLE public.admin_roles OWNER TO postgres;
--
-- Name: admins; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.admins (
id bigint NOT NULL,
address character varying(255),
created_at timestamp without time zone NOT NULL,
email character varying(255) NOT NULL,
id_card character varying(255),
name character varying(255),
password character varying(255),
phone character varying(255) NOT NULL,
updated_at timestamp without time zone NOT NULL,
username character varying(255) NOT NULL
);
ALTER TABLE public.admins OWNER TO postgres;
--
-- Name: admins_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.admins_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.admins_id_seq OWNER TO postgres;
--
-- Name: admins_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.admins_id_seq OWNED BY public.admins.id;
--
-- Name: roles; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.roles (
id bigint NOT NULL,
created_at timestamp without time zone NOT NULL,
name character varying(60),
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE public.roles OWNER TO postgres;
--
-- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.roles_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.roles_id_seq OWNER TO postgres;
--
-- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.roles_id_seq OWNED BY public.roles.id;
--
-- Name: summary_revenue; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.summary_revenue (
id bigint NOT NULL,
created_at timestamp without time zone NOT NULL,
total_revenue numeric(19,2),
updated_at timestamp without time zone NOT NULL,
admin_id bigint
);
ALTER TABLE public.summary_revenue OWNER TO postgres;
--
-- Name: summary_revenue_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.summary_revenue_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.summary_revenue_id_seq OWNER TO postgres;
--
-- Name: summary_revenue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.summary_revenue_id_seq OWNED BY public.summary_revenue.id;
--
-- Name: transactions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.transactions (
id bigint NOT NULL,
created_at timestamp without time zone NOT NULL,
notes text,
status integer,
total_price numeric(19,2),
updated_at timestamp without time zone NOT NULL,
weight integer NOT NULL,
admin_id bigint
);
ALTER TABLE public.transactions OWNER TO postgres;
--
-- Name: transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.transactions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.transactions_id_seq OWNER TO postgres;
--
-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.transactions_id_seq OWNED BY public.transactions.id;
--
-- Name: admins id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.admins ALTER COLUMN id SET DEFAULT nextval('public.admins_id_seq'::regclass);
--
-- Name: roles id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.roles ALTER COLUMN id SET DEFAULT nextval('public.roles_id_seq'::regclass);
--
-- Name: summary_revenue id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.summary_revenue ALTER COLUMN id SET DEFAULT nextval('public.summary_revenue_id_seq'::regclass);
--
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.transactions ALTER COLUMN id SET DEFAULT nextval('public.transactions_id_seq'::regclass);
--
-- Data for Name: admin_roles; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.admin_roles (admin_id, role_id) FROM stdin;
1 1
2 1
\.
--
-- Data for Name: admins; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.admins (id, address, created_at, email, id_card, name, password, phone, updated_at, username) FROM stdin;
1 Laweyan, Solo 2022-09-12 09:57:01.477 email1@email.com 3333123456789 User 01 $2a$10$Cs3WOQOCwA/3LznT89HzAOF7eZevbWpI5/k1diqZ7swM5OQOOe3ai 08123456789 2022-09-12 09:57:01.477 user01
2 Laweyan, Solo 2022-09-12 12:29:47.912 email2@email.com 333312345678910 User 02 $2a$10$ioACrSPTM8ZT1AOYfQiT/.3tL.swZ.f7nfz/iZs996bpDXAxrUOiS 0812345678910 2022-09-12 12:29:47.912 user02
\.
--
-- Data for Name: roles; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.roles (id, created_at, name, updated_at) FROM stdin;
1 2022-09-12 09:47:52.930144 ROLE_ADMIN 2022-09-12 09:47:52.930144
\.
--
-- Data for Name: summary_revenue; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.summary_revenue (id, created_at, total_revenue, updated_at, admin_id) FROM stdin;
1 2022-09-12 12:18:12.169 45000.00 2022-09-12 18:45:54.121 1
2 2022-09-12 12:30:00.031 30000.00 2022-09-12 18:45:54.124 2
\.
--
-- Data for Name: transactions; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.transactions (id, created_at, notes, status, total_price, updated_at, weight, admin_id) FROM stdin;
1 2022-09-12 09:57:32.101 Transaksi 1 Admin 1 0 15000.00 2022-09-12 09:57:32.101 3 1
2 2022-09-12 11:19:18.994 Transaksi 2 Admin 1 0 15000.00 2022-09-12 11:19:18.994 3 1
3 2022-09-12 12:10:02.213 Transaksi 3 Admin 1 0 15000.00 2022-09-12 12:10:02.213 3 1
4 2022-09-12 12:29:57.164 Transaksi 1 Admin 2 0 15000.00 2022-09-12 12:29:57.164 3 2
5 2022-09-12 12:31:07.836 Transaksi 2 Admin 2 0 15000.00 2022-09-12 12:31:07.836 3 2
\.
--
-- Name: admins_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.admins_id_seq', 2, true);
--
-- Name: roles_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.roles_id_seq', 1, true);
--
-- Name: summary_revenue_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.summary_revenue_id_seq', 2, true);
--
-- Name: transactions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.transactions_id_seq', 5, true);
--
-- Name: admin_roles admin_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.admin_roles
ADD CONSTRAINT admin_roles_pkey PRIMARY KEY (admin_id, role_id);
--
-- Name: admins admins_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.admins
ADD CONSTRAINT admins_pkey PRIMARY KEY (id);
--
-- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.roles
ADD CONSTRAINT roles_pkey PRIMARY KEY (id);
--
-- Name: summary_revenue summary_revenue_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.summary_revenue
ADD CONSTRAINT summary_revenue_pkey PRIMARY KEY (id);
--
-- Name: transactions transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.transactions
ADD CONSTRAINT transactions_pkey PRIMARY KEY (id);
--
-- Name: admins uk_40k3ldiov4eh6w3vk8046lic; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.admins
ADD CONSTRAINT uk_40k3ldiov4eh6w3vk8046lic UNIQUE (email, phone, username);
--
-- Name: roles uk_nb4h0p6txrmfc0xbrd1kglp9t; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.roles
ADD CONSTRAINT uk_nb4h0p6txrmfc0xbrd1kglp9t UNIQUE (name);
--
-- Name: admin_roles fk3liyab508sfblqps0eqjhmjqk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.admin_roles
ADD CONSTRAINT fk3liyab508sfblqps0eqjhmjqk FOREIGN KEY (role_id) REFERENCES public.roles(id);
--
-- Name: transactions fkcld5louxmdqxvivbradq5g23r; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.transactions
ADD CONSTRAINT fkcld5louxmdqxvivbradq5g23r FOREIGN KEY (admin_id) REFERENCES public.admins(id);
--
-- Name: admin_roles fkghcw89q6jebq3c6kocnobjusr; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.admin_roles
ADD CONSTRAINT fkghcw89q6jebq3c6kocnobjusr FOREIGN KEY (admin_id) REFERENCES public.admins(id);
--
-- Name: summary_revenue fksg88fdt3bygok7vqpdeno6jly; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.summary_revenue
ADD CONSTRAINT fksg88fdt3bygok7vqpdeno6jly FOREIGN KEY (admin_id) REFERENCES public.admins(id);
--
-- PostgreSQL database dump complete
--
--
-- Database "postgres" dump
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.5 (Debian 14.5-1.pgdg110+1)
-- Dumped by pg_dump version 14.5 (Debian 14.5-1.pgdg110+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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;
DROP DATABASE postgres;
--
-- Name: postgres; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE postgres WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = 'en_US.utf8';
ALTER DATABASE postgres OWNER TO postgres;
\connect postgres
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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: DATABASE postgres; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON DATABASE postgres IS 'default administrative connection database';
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database cluster dump complete
--