add db schema
This commit is contained in:
parent
51951f7697
commit
c4f4b861c3
158
schema/main.sql
Normal file
158
schema/main.sql
Normal file
@ -0,0 +1,158 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 10.1
|
||||
-- Dumped by pg_dump version 10.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;
|
||||
SET check_function_bodies = false;
|
||||
SET client_min_messages = warning;
|
||||
SET row_security = off;
|
||||
|
||||
SET search_path = public, pg_catalog;
|
||||
|
||||
ALTER TABLE IF EXISTS ONLY public.sessions DROP CONSTRAINT IF EXISTS sessions_pkey;
|
||||
ALTER TABLE IF EXISTS ONLY public.commands DROP CONSTRAINT IF EXISTS commands_channel_command_pk;
|
||||
ALTER TABLE IF EXISTS ONLY public.channels DROP CONSTRAINT IF EXISTS channels_name_idx;
|
||||
ALTER TABLE IF EXISTS ONLY public.channels DROP CONSTRAINT IF EXISTS channels_id_pk;
|
||||
DROP TABLE IF EXISTS public.sessions;
|
||||
DROP TABLE IF EXISTS public.commands;
|
||||
DROP TABLE IF EXISTS public.channels;
|
||||
DROP EXTENSION IF EXISTS "uuid-ossp";
|
||||
DROP EXTENSION IF EXISTS plpgsql;
|
||||
DROP SCHEMA IF EXISTS public;
|
||||
--
|
||||
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE SCHEMA public;
|
||||
|
||||
|
||||
--
|
||||
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON SCHEMA public IS 'standard public schema';
|
||||
|
||||
|
||||
--
|
||||
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
|
||||
|
||||
--
|
||||
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
||||
|
||||
|
||||
--
|
||||
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
|
||||
|
||||
|
||||
--
|
||||
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
|
||||
|
||||
|
||||
SET search_path = public, pg_catalog;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- Name: channels; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE channels (
|
||||
"join" boolean DEFAULT false,
|
||||
ctime timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
|
||||
mtime timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
|
||||
id uuid DEFAULT uuid_generate_v4() NOT NULL,
|
||||
name character varying(100) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: commands; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE commands (
|
||||
message text,
|
||||
ctime timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
|
||||
mtime timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
|
||||
command character varying(100) NOT NULL,
|
||||
channel character varying(100) NOT NULL,
|
||||
active boolean DEFAULT true
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: sessions; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE sessions (
|
||||
sid character varying(100) NOT NULL,
|
||||
data text NOT NULL,
|
||||
ctime timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
|
||||
mtime timestamp with time zone DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: channels channels_id_pk; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY channels
|
||||
ADD CONSTRAINT channels_id_pk PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: channels channels_name_idx; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY channels
|
||||
ADD CONSTRAINT channels_name_idx UNIQUE (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: commands commands_channel_command_pk; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY commands
|
||||
ADD CONSTRAINT commands_channel_command_pk PRIMARY KEY (channel, command);
|
||||
|
||||
|
||||
--
|
||||
-- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY sessions
|
||||
ADD CONSTRAINT sessions_pkey PRIMARY KEY (sid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: public; Type: ACL; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
GRANT ALL ON SCHEMA public TO PUBLIC;
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user