katbin/priv/repo/structure.sql
SphericalKat 3f424a41c1
chore: migrate to prod
Signed-off-by: SphericalKat <amolele@gmail.com>
2021-10-08 01:56:42 +05:30

221 lines
4.9 KiB
SQL

--
-- PostgreSQL database dump
--
-- Dumped from database version 13.4 (Debian 13.4-1.pgdg100+1)
-- Dumped by pg_dump version 13.4
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: citext; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public;
--
-- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings';
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: pastes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.pastes (
id character varying(255) NOT NULL,
is_url boolean DEFAULT false NOT NULL,
content text NOT NULL,
belongs_to bigint
);
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.schema_migrations (
version bigint NOT NULL,
inserted_at timestamp(0) without time zone
);
--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.users (
id bigint NOT NULL,
email public.citext NOT NULL,
hashed_password character varying(255) NOT NULL,
confirmed_at timestamp(0) without time zone,
inserted_at timestamp(0) without time zone NOT NULL,
updated_at timestamp(0) without time zone NOT NULL
);
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.users_id_seq
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: users_tokens; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.users_tokens (
id bigint NOT NULL,
user_id bigint NOT NULL,
token bytea NOT NULL,
context character varying(255) NOT NULL,
sent_to character varying(255),
inserted_at timestamp(0) without time zone NOT NULL
);
--
-- Name: users_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.users_tokens_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: users_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.users_tokens_id_seq OWNED BY public.users_tokens.id;
--
-- 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: users_tokens id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users_tokens ALTER COLUMN id SET DEFAULT nextval('public.users_tokens_id_seq'::regclass);
--
-- Name: pastes pastes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pastes
ADD CONSTRAINT pastes_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: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: users_tokens users_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users_tokens
ADD CONSTRAINT users_tokens_pkey PRIMARY KEY (id);
--
-- Name: pastes_belongs_to_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX pastes_belongs_to_index ON public.pastes USING btree (belongs_to);
--
-- Name: users_email_index; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX users_email_index ON public.users USING btree (email);
--
-- Name: users_tokens_context_token_index; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX users_tokens_context_token_index ON public.users_tokens USING btree (context, token);
--
-- Name: users_tokens_user_id_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX users_tokens_user_id_index ON public.users_tokens USING btree (user_id);
--
-- Name: pastes pastes_belongs_to_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pastes
ADD CONSTRAINT pastes_belongs_to_fkey FOREIGN KEY (belongs_to) REFERENCES public.users(id) ON DELETE CASCADE;
--
-- Name: users_tokens users_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users_tokens
ADD CONSTRAINT users_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--
INSERT INTO public."schema_migrations" (version) VALUES (20210811065554);
INSERT INTO public."schema_migrations" (version) VALUES (20210811213141);