auth-api/db/schema.sql

108 lines
2.4 KiB
MySQL
Raw Normal View History

2020-12-29 13:46:58 +01:00
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;
--
2021-01-02 11:56:24 +01:00
-- Name: accounts; Type: TABLE; Schema: public; Owner: -
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
CREATE TABLE public.accounts (
id uuid NOT NULL,
created timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
"accountName" text NOT NULL,
"apiKey" text,
password text
2020-12-29 13:46:58 +01:00
);
--
2021-01-02 11:56:24 +01:00
-- Name: accountsFields; Type: TABLE; Schema: public; Owner: -
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
CREATE TABLE public."accountsFields" (
2020-12-29 13:46:58 +01:00
id uuid NOT NULL,
created timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
2021-01-02 11:56:24 +01:00
"accountId" uuid NOT NULL,
name text NOT NULL,
value text[] NOT NULL
2020-12-29 13:46:58 +01:00
);
--
2021-01-02 11:56:24 +01:00
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
CREATE TABLE public.schema_migrations (
version character varying(255) NOT NULL
2020-12-29 13:46:58 +01:00
);
--
2021-01-02 11:56:24 +01:00
-- Name: accountsFields accountsFields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
ALTER TABLE ONLY public."accountsFields"
ADD CONSTRAINT "accountsFields_pkey" PRIMARY KEY (id);
--
-- Name: accounts accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.accounts
ADD CONSTRAINT accounts_pkey PRIMARY KEY (id);
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
ALTER TABLE ONLY public.schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
-- Name: idx_accountname; Type: INDEX; Schema: public; Owner: -
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
CREATE UNIQUE INDEX idx_accountname ON public.accounts USING btree ("accountName");
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
-- Name: idx_accountsfields; Type: INDEX; Schema: public; Owner: -
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
CREATE UNIQUE INDEX idx_accountsfields ON public."accountsFields" USING btree ("accountId", name);
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
-- Name: accountsFields accountsFields_accountId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2020-12-29 13:46:58 +01:00
--
2021-01-02 11:56:24 +01:00
ALTER TABLE ONLY public."accountsFields"
ADD CONSTRAINT "accountsFields_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES public.accounts(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
2020-12-29 13:46:58 +01:00
--
-- PostgreSQL database dump complete
--
--
-- Dbmate schema migrations
--
INSERT INTO public.schema_migrations (version) VALUES
('20201207191913');