336 lines
7.1 KiB
MySQL
336 lines
7.1 KiB
MySQL
|
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;
|
||
|
|
||
|
SET default_tablespace = '';
|
||
|
|
||
|
SET default_table_access_method = heap;
|
||
|
|
||
|
--
|
||
|
-- Name: emails; Type: TABLE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE TABLE public.emails (
|
||
|
id integer NOT NULL,
|
||
|
uid integer NOT NULL,
|
||
|
email character varying(320) NOT NULL,
|
||
|
"verificationSecret" character varying(255)
|
||
|
);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: emails_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE SEQUENCE public.emails_id_seq
|
||
|
AS integer
|
||
|
START WITH 1
|
||
|
INCREMENT BY 1
|
||
|
NO MINVALUE
|
||
|
NO MAXVALUE
|
||
|
CACHE 1;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER SEQUENCE public.emails_id_seq OWNED BY public.emails.id;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: keys; Type: TABLE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE TABLE public.keys (
|
||
|
id integer NOT NULL,
|
||
|
uid integer NOT NULL,
|
||
|
data bytea NOT NULL,
|
||
|
expires timestamp without time zone,
|
||
|
uploaded timestamp without time zone NOT NULL,
|
||
|
comment text NOT NULL,
|
||
|
"isPrimaryEncryptionKey" boolean NOT NULL
|
||
|
);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: keys_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE SEQUENCE public.keys_id_seq
|
||
|
AS integer
|
||
|
START WITH 1
|
||
|
INCREMENT BY 1
|
||
|
NO MINVALUE
|
||
|
NO MAXVALUE
|
||
|
CACHE 1;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER SEQUENCE public.keys_id_seq OWNED BY public.keys.id;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE TABLE public.schema_migrations (
|
||
|
version character varying(255) NOT NULL
|
||
|
);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens; Type: TABLE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE TABLE public.tokens (
|
||
|
id integer NOT NULL,
|
||
|
uid integer NOT NULL,
|
||
|
name text,
|
||
|
data text NOT NULL,
|
||
|
comment text NOT NULL,
|
||
|
issued timestamp without time zone NOT NULL,
|
||
|
expires timestamp without time zone,
|
||
|
permissions text
|
||
|
);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE SEQUENCE public.tokens_id_seq
|
||
|
AS integer
|
||
|
START WITH 1
|
||
|
INCREMENT BY 1
|
||
|
NO MINVALUE
|
||
|
NO MAXVALUE
|
||
|
CACHE 1;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER SEQUENCE public.tokens_id_seq OWNED BY public.tokens.id;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: users; Type: TABLE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE TABLE public.users (
|
||
|
id integer NOT NULL,
|
||
|
registered timestamp without time zone NOT NULL,
|
||
|
"passwordCrypt" bytea NOT NULL,
|
||
|
permissions text NOT NULL,
|
||
|
accepted timestamp without time zone,
|
||
|
rejected timestamp without time zone,
|
||
|
seceded timestamp without time zone,
|
||
|
"toBeDeleted" timestamp without time zone,
|
||
|
"memberData" jsonb NOT NULL
|
||
|
);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE SEQUENCE public.users_id_seq
|
||
|
AS integer
|
||
|
START WITH 1
|
||
|
INCREMENT BY 1
|
||
|
NO MINVALUE
|
||
|
NO MAXVALUE
|
||
|
CACHE 1;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: emails id; Type: DEFAULT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.emails ALTER COLUMN id SET DEFAULT nextval('public.emails_id_seq'::regclass);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: keys id; Type: DEFAULT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.keys ALTER COLUMN id SET DEFAULT nextval('public.keys_id_seq'::regclass);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens id; Type: DEFAULT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.tokens ALTER COLUMN id SET DEFAULT nextval('public.tokens_id_seq'::regclass);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: users id; Type: DEFAULT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: emails emails_email_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.emails
|
||
|
ADD CONSTRAINT emails_email_key UNIQUE (email);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: emails emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.emails
|
||
|
ADD CONSTRAINT emails_pkey PRIMARY KEY (id);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: emails emails_verificationSecret_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.emails
|
||
|
ADD CONSTRAINT "emails_verificationSecret_key" UNIQUE ("verificationSecret");
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: keys keys_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.keys
|
||
|
ADD CONSTRAINT keys_pkey PRIMARY KEY (id);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.schema_migrations
|
||
|
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens tokens_data_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.tokens
|
||
|
ADD CONSTRAINT tokens_data_key UNIQUE (data);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens tokens_name_uid_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.tokens
|
||
|
ADD CONSTRAINT tokens_name_uid_key UNIQUE (name, uid);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.tokens
|
||
|
ADD CONSTRAINT tokens_pkey PRIMARY KEY (id);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.users
|
||
|
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: emails_uid_verified; Type: INDEX; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE UNIQUE INDEX emails_uid_verified ON public.emails USING btree (uid, (("verificationSecret" IS NOT NULL)));
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: keys_isPrimaryEncryptionKey_constraint; Type: INDEX; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE UNIQUE INDEX "keys_isPrimaryEncryptionKey_constraint" ON public.keys USING btree (uid) WHERE "isPrimaryEncryptionKey";
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: keys_uid_index; Type: INDEX; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE INDEX keys_uid_index ON public.keys USING btree (uid);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens_data_index; Type: INDEX; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE INDEX tokens_data_index ON public.tokens USING btree (data);
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: users_memberData_index; Type: INDEX; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
CREATE INDEX "users_memberData_index" ON public.users USING gin ("memberData");
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: emails emails_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.emails
|
||
|
ADD CONSTRAINT emails_uid_fkey FOREIGN KEY (uid) REFERENCES public.users(id) ON DELETE CASCADE;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: keys keys_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.keys
|
||
|
ADD CONSTRAINT keys_uid_fkey FOREIGN KEY (uid) REFERENCES public.users(id) ON DELETE CASCADE;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Name: tokens tokens_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||
|
--
|
||
|
|
||
|
ALTER TABLE ONLY public.tokens
|
||
|
ADD CONSTRAINT tokens_uid_fkey FOREIGN KEY (uid) REFERENCES public.users(id) ON DELETE CASCADE;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- PostgreSQL database dump complete
|
||
|
--
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Dbmate schema migrations
|
||
|
--
|
||
|
|
||
|
INSERT INTO public.schema_migrations (version) VALUES
|
||
|
('20221208114323'),
|
||
|
('20230917064352');
|