mtfosbot/schema/main.sql

233 lines
6.3 KiB
MySQL
Raw Normal View History

--
-- PostgreSQL database dump
--
2018-06-27 15:38:56 +00:00
-- Dumped from database version 10.2 (Debian 10.2-1.pgdg90+1)
-- Dumped by pg_dump version 10.2 (Debian 10.2-1.pgdg90+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;
2018-06-27 15:38:56 +00:00
SET search_path = public, pg_catalog;
ALTER TABLE IF EXISTS ONLY public.line_twitch_rt DROP CONSTRAINT IF EXISTS line_twitch_rt_twitch_channel_id_fk;
ALTER TABLE IF EXISTS ONLY public.line_twitch_rt DROP CONSTRAINT IF EXISTS line_twitch_rt_line_group_id_fk;
ALTER TABLE IF EXISTS ONLY public.line_fb_rt DROP CONSTRAINT IF EXISTS line_fb_rt_line_group_id_fk;
ALTER TABLE IF EXISTS ONLY public.line_fb_rt DROP CONSTRAINT IF EXISTS line_fb_rt_facebook_page_id_fk;
2018-06-27 09:50:56 +00:00
DROP INDEX IF EXISTS public.line_group_name_uindex;
2018-06-27 15:38:56 +00:00
ALTER TABLE IF EXISTS ONLY public.twitch_channel DROP CONSTRAINT IF EXISTS twitch_channel_id_pk;
ALTER TABLE IF EXISTS ONLY public.line_twitch_rt DROP CONSTRAINT IF EXISTS line_twitch_rt_line_twitch_pk;
2018-06-27 09:50:56 +00:00
ALTER TABLE IF EXISTS ONLY public.line_group DROP CONSTRAINT IF EXISTS line_group_pkey;
2018-06-27 15:38:56 +00:00
ALTER TABLE IF EXISTS ONLY public.line_fb_rt DROP CONSTRAINT IF EXISTS line_fb_rt_facebook_line_pk;
ALTER TABLE IF EXISTS ONLY public.facebook_page DROP CONSTRAINT IF EXISTS facebook_page_id_pk;
DROP TABLE IF EXISTS public.version_ctrl;
2018-06-27 09:50:56 +00:00
DROP TABLE IF EXISTS public.twitch_channel;
2018-06-27 15:38:56 +00:00
DROP TABLE IF EXISTS public.line_twitch_rt;
2018-06-27 09:50:56 +00:00
DROP TABLE IF EXISTS public.line_group;
2018-06-27 15:38:56 +00:00
DROP TABLE IF EXISTS public.line_fb_rt;
2018-06-27 09:50:56 +00:00
DROP TABLE IF EXISTS public.facebook_page;
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';
2018-06-27 15:38:56 +00:00
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
2018-06-27 09:50:56 +00:00
-- Name: facebook_page; Type: TABLE; Schema: public; Owner: -
--
2018-06-27 15:38:56 +00:00
CREATE TABLE facebook_page (
id character varying(200) NOT NULL,
2018-06-27 09:50:56 +00:00
lastpost character varying(100) DEFAULT ''::character varying NOT NULL,
ctime timestamp with time zone DEFAULT now() NOT NULL,
mtime timestamp with time zone DEFAULT now() NOT NULL
);
--
2018-06-27 15:38:56 +00:00
-- Name: line_fb_rt; Type: TABLE; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
CREATE TABLE line_fb_rt (
line character varying(100) NOT NULL,
facebook character varying(200) NOT NULL,
tmpl character varying(300) DEFAULT ''::character varying NOT NULL
);
2018-06-27 09:50:56 +00:00
--
-- Name: line_group; Type: TABLE; Schema: public; Owner: -
--
2018-06-27 15:38:56 +00:00
CREATE TABLE line_group (
2018-06-27 09:50:56 +00:00
id character varying(100) NOT NULL,
name character varying(200) NOT NULL,
notify boolean DEFAULT false NOT NULL,
2018-06-27 09:50:56 +00:00
ctime timestamp with time zone DEFAULT now() NOT NULL,
mtime timestamp with time zone DEFAULT now() NOT NULL,
owner character varying(100) DEFAULT ''::character varying NOT NULL
);
2018-06-27 15:38:56 +00:00
--
-- Name: line_twitch_rt; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE line_twitch_rt (
line character varying(100) NOT NULL,
twitch character varying(100) NOT NULL,
tmpl character varying(300) DEFAULT ''::character varying NOT NULL
);
2018-06-27 09:50:56 +00:00
--
-- Name: twitch_channel; Type: TABLE; Schema: public; Owner: -
--
2018-06-27 15:38:56 +00:00
CREATE TABLE twitch_channel (
id character varying(100) NOT NULL,
2018-06-27 09:50:56 +00:00
name character varying(200) NOT NULL,
type character varying(100) DEFAULT ''::character varying NOT NULL,
ctime timestamp with time zone DEFAULT now() NOT NULL,
2018-06-27 15:38:56 +00:00
mtime timestamp with time zone DEFAULT now() NOT NULL
2018-06-27 09:50:56 +00:00
);
--
2018-06-27 15:38:56 +00:00
-- Name: version_ctrl; Type: TABLE; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
CREATE TABLE version_ctrl (
version integer NOT NULL,
ctime timestamp with time zone DEFAULT now() NOT NULL,
querystr text DEFAULT ''::character varying NOT NULL
);
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: facebook_page facebook_page_id_pk; Type: CONSTRAINT; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY facebook_page
ADD CONSTRAINT facebook_page_id_pk PRIMARY KEY (id);
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: line_fb_rt line_fb_rt_facebook_line_pk; Type: CONSTRAINT; Schema: public; Owner: -
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY line_fb_rt
ADD CONSTRAINT line_fb_rt_facebook_line_pk PRIMARY KEY (facebook, line);
--
2018-06-27 15:38:56 +00:00
-- Name: line_group line_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY line_group
ADD CONSTRAINT line_group_pkey PRIMARY KEY (id);
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: line_twitch_rt line_twitch_rt_line_twitch_pk; Type: CONSTRAINT; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY line_twitch_rt
ADD CONSTRAINT line_twitch_rt_line_twitch_pk PRIMARY KEY (line, twitch);
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: twitch_channel twitch_channel_id_pk; Type: CONSTRAINT; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY twitch_channel
ADD CONSTRAINT twitch_channel_id_pk PRIMARY KEY (id);
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: line_group_name_uindex; Type: INDEX; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
CREATE UNIQUE INDEX line_group_name_uindex ON line_group USING btree (name);
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: line_fb_rt line_fb_rt_facebook_page_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY line_fb_rt
ADD CONSTRAINT line_fb_rt_facebook_page_id_fk FOREIGN KEY (facebook) REFERENCES facebook_page(id) ON DELETE CASCADE;
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: line_fb_rt line_fb_rt_line_group_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY line_fb_rt
ADD CONSTRAINT line_fb_rt_line_group_id_fk FOREIGN KEY (line) REFERENCES line_group(id) ON DELETE CASCADE;
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: line_twitch_rt line_twitch_rt_line_group_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY line_twitch_rt
ADD CONSTRAINT line_twitch_rt_line_group_id_fk FOREIGN KEY (line) REFERENCES line_group(id) ON DELETE CASCADE;
2018-06-27 09:50:56 +00:00
--
2018-06-27 15:38:56 +00:00
-- Name: line_twitch_rt line_twitch_rt_twitch_channel_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
2018-06-27 15:38:56 +00:00
ALTER TABLE ONLY line_twitch_rt
ADD CONSTRAINT line_twitch_rt_twitch_channel_id_fk FOREIGN KEY (twitch) REFERENCES twitch_channel(id) ON DELETE CASCADE;
--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: -
--
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--