Files
bgApp/scripts/dbCreate.sql
2026-02-13 22:15:18 +00:00

240 lines
5.4 KiB
SQL

--
-- PostgreSQL database dump
--
-- Dumped from database version 18.1 (Debian 18.1-1.pgdg13+2)
-- Dumped by pg_dump version 18.1
-- Started on 2026-02-13 18:14:42 GMT
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;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- TOC entry 224 (class 1259 OID 16431)
-- Name: claims; Type: TABLE; Schema: public; Owner: admin
--
CREATE TABLE public.claims (
id integer NOT NULL,
name character varying(60) NOT NULL,
is_default boolean DEFAULT false NOT NULL
);
ALTER TABLE public.claims OWNER TO admin;
--
-- TOC entry 223 (class 1259 OID 16430)
-- Name: claims_id_seq; Type: SEQUENCE; Schema: public; Owner: admin
--
CREATE SEQUENCE public.claims_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.claims_id_seq OWNER TO admin;
--
-- TOC entry 3465 (class 0 OID 0)
-- Dependencies: 223
-- Name: claims_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: admin
--
ALTER SEQUENCE public.claims_id_seq OWNED BY public.claims.id;
--
-- TOC entry 225 (class 1259 OID 16439)
-- Name: user_claims; Type: TABLE; Schema: public; Owner: admin
--
CREATE TABLE public.user_claims (
userid bigint,
claimid integer
);
ALTER TABLE public.user_claims OWNER TO admin;
--
-- TOC entry 222 (class 1259 OID 16392)
-- Name: users; Type: TABLE; Schema: public; Owner: admin
--
CREATE TABLE public.users (
id bigint NOT NULL,
username character varying(20) NOT NULL,
pass_hash text NOT NULL,
is_active boolean DEFAULT true CONSTRAINT users_active_not_null NOT NULL,
is_admin boolean DEFAULT false NOT NULL
);
ALTER TABLE public.users OWNER TO admin;
--
-- TOC entry 219 (class 1259 OID 16389)
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: admin
--
CREATE SEQUENCE public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.users_id_seq OWNER TO admin;
--
-- TOC entry 3466 (class 0 OID 0)
-- Dependencies: 219
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: admin
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- TOC entry 221 (class 1259 OID 16391)
-- Name: users_pass_hash_seq; Type: SEQUENCE; Schema: public; Owner: admin
--
CREATE SEQUENCE public.users_pass_hash_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.users_pass_hash_seq OWNER TO admin;
--
-- TOC entry 3467 (class 0 OID 0)
-- Dependencies: 221
-- Name: users_pass_hash_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: admin
--
ALTER SEQUENCE public.users_pass_hash_seq OWNED BY public.users.pass_hash;
--
-- TOC entry 220 (class 1259 OID 16390)
-- Name: users_username_seq; Type: SEQUENCE; Schema: public; Owner: admin
--
CREATE SEQUENCE public.users_username_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.users_username_seq OWNER TO admin;
--
-- TOC entry 3468 (class 0 OID 0)
-- Dependencies: 220
-- Name: users_username_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: admin
--
ALTER SEQUENCE public.users_username_seq OWNED BY public.users.username;
--
-- TOC entry 3305 (class 2604 OID 16434)
-- Name: claims id; Type: DEFAULT; Schema: public; Owner: admin
--
ALTER TABLE ONLY public.claims ALTER COLUMN id SET DEFAULT nextval('public.claims_id_seq'::regclass);
--
-- TOC entry 3300 (class 2604 OID 16395)
-- Name: users id; Type: DEFAULT; Schema: public; Owner: admin
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- TOC entry 3301 (class 2604 OID 16405)
-- Name: users username; Type: DEFAULT; Schema: public; Owner: admin
--
ALTER TABLE ONLY public.users ALTER COLUMN username SET DEFAULT nextval('public.users_username_seq'::regclass);
--
-- TOC entry 3302 (class 2604 OID 16411)
-- Name: users pass_hash; Type: DEFAULT; Schema: public; Owner: admin
--
ALTER TABLE ONLY public.users ALTER COLUMN pass_hash SET DEFAULT nextval('public.users_pass_hash_seq'::regclass);
--
-- TOC entry 3310 (class 2606 OID 16438)
-- Name: claims claims_pkey; Type: CONSTRAINT; Schema: public; Owner: admin
--
ALTER TABLE ONLY public.claims
ADD CONSTRAINT claims_pkey PRIMARY KEY (id);
--
-- TOC entry 3308 (class 2606 OID 16403)
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: admin
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- TOC entry 3311 (class 2606 OID 16447)
-- Name: user_claims user_claims_claimid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin
--
ALTER TABLE ONLY public.user_claims
ADD CONSTRAINT user_claims_claimid_fkey FOREIGN KEY (claimid) REFERENCES public.claims(id);
--
-- TOC entry 3312 (class 2606 OID 16442)
-- Name: user_claims user_claims_userid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin
--
ALTER TABLE ONLY public.user_claims
ADD CONSTRAINT user_claims_userid_fkey FOREIGN KEY (userid) REFERENCES public.users(id);
-- Completed on 2026-02-13 18:14:43 GMT
--
-- PostgreSQL database dump complete
--