From 33f8a1dc6ea0de9323e9a75f5366fa68d8325774 Mon Sep 17 00:00:00 2001 From: jay Date: Wed, 19 Sep 2018 20:22:33 +0800 Subject: [PATCH] make submodule --- 20180628-1.sql | 2 + 20180628-2.sql | 1 + 20180702-1.sql | 19 ++++ 20180706-1.sql | 29 +++++++ 20180710-1.sql | 2 + 20180711-1.sql | 2 + 20180712-1.sql | 11 +++ 20180716-1.sql | 2 + 20180718-1.sql | 1 + 20180719-1.sql | 16 ++++ 20180721-1.sql | 3 + 20180807-1.sql | 2 + 20180811-1.sql | 11 +++ 20180815-1.sql | 8 ++ 20180816-1.sql | 3 + 20180826-1.sql | 1 + 20180828-1.sql | 21 +++++ dbVersion.json | 23 +++++ main.sql | 232 +++++++++++++++++++++++++++++++++++++++++++++++++ 19 files changed, 389 insertions(+) create mode 100644 20180628-1.sql create mode 100644 20180628-2.sql create mode 100644 20180702-1.sql create mode 100644 20180706-1.sql create mode 100644 20180710-1.sql create mode 100644 20180711-1.sql create mode 100644 20180712-1.sql create mode 100644 20180716-1.sql create mode 100644 20180718-1.sql create mode 100644 20180719-1.sql create mode 100644 20180721-1.sql create mode 100644 20180807-1.sql create mode 100644 20180811-1.sql create mode 100644 20180815-1.sql create mode 100644 20180816-1.sql create mode 100644 20180826-1.sql create mode 100644 20180828-1.sql create mode 100644 dbVersion.json create mode 100644 main.sql diff --git a/20180628-1.sql b/20180628-1.sql new file mode 100644 index 0000000..37df241 --- /dev/null +++ b/20180628-1.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.twitch_channel DROP type; +ALTER TABLE public.line_twitch_rt ADD type varchar(100) DEFAULT '' NOT NULL; \ No newline at end of file diff --git a/20180628-2.sql b/20180628-2.sql new file mode 100644 index 0000000..df753b6 --- /dev/null +++ b/20180628-2.sql @@ -0,0 +1 @@ +ALTER TABLE public.twitch_channel ADD laststream varchar(100) DEFAULT '' NOT NULL; \ No newline at end of file diff --git a/20180702-1.sql b/20180702-1.sql new file mode 100644 index 0000000..4f9a93a --- /dev/null +++ b/20180702-1.sql @@ -0,0 +1,19 @@ +-- auto-generated definition +create table "public"."commands" +( + cmd varchar(200) not null + constraint commands_pkey + primary key, + message varchar(300) default '' :: character varying not null, + ctime timestamp with time zone default CURRENT_TIMESTAMP not null, + mtime timestamp with time zone default CURRENT_TIMESTAMP not null, + "group" varchar(100) default '' :: character varying not null +); + +insert into "public"."commands" ("cmd", "message", "ctime", "mtime", "group") values +('addgroup', '{{addgroup}}', now(), now(), ''), +('addpage', '{{addpage}}', now(), now(), ''), +('delpage', '{{delpage}}', now(), now(), ''), +('addtwitch', '{{addtwitch}}', now(), now(), ''), +('deltwitch', '{{deltwitch}}', now(), now(), ''), +('hello', '{{hello}}', now(), now(), ''); \ No newline at end of file diff --git a/20180706-1.sql b/20180706-1.sql new file mode 100644 index 0000000..661e1eb --- /dev/null +++ b/20180706-1.sql @@ -0,0 +1,29 @@ +-- auto-generated definition +create table public.youtube_channel +( + id varchar(150) not null + constraint youtube_channel_pkey + primary key, + name varchar(150) not null, + lastvideo varchar(150) default '' :: character varying not null, + expire integer default '-1' :: integer not null, + ctime timestamp with time zone default now() not null, + mtime timestamp with time zone default now() not null +); + +-- auto-generated definition +create table public.line_youtube_rt +( + line varchar(100) not null + constraint line_youtube_rt_line_group_id_fk + references public.line_group + on delete cascade, + youtube varchar(150) not null + constraint line_youtube_rt_youtube_channel_id_fk + references public.youtube_channel + on delete cascade, + tmpl varchar(300) default '' :: character varying not null, + constraint line_youtube_rt_line_youtube_pk + primary key (line, youtube) +); + diff --git a/20180710-1.sql b/20180710-1.sql new file mode 100644 index 0000000..0691673 --- /dev/null +++ b/20180710-1.sql @@ -0,0 +1,2 @@ +insert into "public"."commands" ("cmd", "message", "ctime", "mtime", "group") values +('addyoutube', '{{addyoutube}}', now(), now(), ''); \ No newline at end of file diff --git a/20180711-1.sql b/20180711-1.sql new file mode 100644 index 0000000..02d18fe --- /dev/null +++ b/20180711-1.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.commands DROP CONSTRAINT commands_pkey; +ALTER TABLE public.commands ADD CONSTRAINT commands_pkey PRIMARY KEY (cmd, "group"); \ No newline at end of file diff --git a/20180712-1.sql b/20180712-1.sql new file mode 100644 index 0000000..8afa970 --- /dev/null +++ b/20180712-1.sql @@ -0,0 +1,11 @@ +-- auto-generated definition +create table key_commands +( + key varchar(100) not null, + "group" varchar(150) default '' :: character varying not null, + message varchar(300) default '' :: character varying not null, + ctime timestamp with time zone default CURRENT_TIMESTAMP not null, + mtime timestamp with time zone default CURRENT_TIMESTAMP not null, + constraint key_commands_key_group_pk + primary key (key, "group") +); \ No newline at end of file diff --git a/20180716-1.sql b/20180716-1.sql new file mode 100644 index 0000000..a04e770 --- /dev/null +++ b/20180716-1.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.twitch_channel ADD "join" boolean DEFAULT false NOT NULL; +ALTER TABLE public.twitch_channel ADD opayid varchar(150) DEFAULT '' NOT NULL; \ No newline at end of file diff --git a/20180718-1.sql b/20180718-1.sql new file mode 100644 index 0000000..b83770b --- /dev/null +++ b/20180718-1.sql @@ -0,0 +1 @@ +ALTER TABLE public.youtube_channel ALTER COLUMN expire TYPE bigint USING expire::bigint; \ No newline at end of file diff --git a/20180719-1.sql b/20180719-1.sql new file mode 100644 index 0000000..74cb0c6 --- /dev/null +++ b/20180719-1.sql @@ -0,0 +1,16 @@ +create extension "uuid-ossp" with schema public; + +-- auto-generated definition +create table public.donate_list +( + id uuid default public.uuid_generate_v4() not null + constraint donate_list_pkey + primary key, + opayid varchar(200) not null, + donate_id varchar(200) not null, + price integer default 0 not null, + text varchar(1000) default '' :: character varying not null, + ctime timestamp with time zone default CURRENT_TIMESTAMP not null, + name varchar(100) default '' :: character varying not null +); + diff --git a/20180721-1.sql b/20180721-1.sql new file mode 100644 index 0000000..fcb9dcd --- /dev/null +++ b/20180721-1.sql @@ -0,0 +1,3 @@ +ALTER TABLE public.donate_list DROP CONSTRAINT donate_list_pkey; +ALTER TABLE public.donate_list ADD CONSTRAINT donate_list_opayid_donate_id_pk PRIMARY KEY (opayid, donate_id); +ALTER TABLE public.donate_list DROP id; \ No newline at end of file diff --git a/20180807-1.sql b/20180807-1.sql new file mode 100644 index 0000000..f054f3e --- /dev/null +++ b/20180807-1.sql @@ -0,0 +1,2 @@ +insert into "public"."commands" ("cmd", "message", "ctime", "mtime", "group") values +('roll', '{{roll}}', now(), now(), ''); \ No newline at end of file diff --git a/20180811-1.sql b/20180811-1.sql new file mode 100644 index 0000000..296fe10 --- /dev/null +++ b/20180811-1.sql @@ -0,0 +1,11 @@ +CREATE TABLE public.donate_progres +( + twitch varchar(100) PRIMARY KEY NOT NULL, + start_date timestamp with time zone, + end_date timestamp with time zone, + target_amount int DEFAULT 0 NOT NULL, + title varchar(200) DEFAULT '' NOT NULL, + ctime timestamp with time zone DEFAULT current_timestamp NOT NULL, + mtime timestamp with time zone DEFAULT current_timestamp NOT NULL, + CONSTRAINT donate_progres_twitch_channel_id_fk FOREIGN KEY (twitch) REFERENCES public.twitch_channel (id) ON DELETE CASCADE +); \ No newline at end of file diff --git a/20180815-1.sql b/20180815-1.sql new file mode 100644 index 0000000..b0af6ce --- /dev/null +++ b/20180815-1.sql @@ -0,0 +1,8 @@ +CREATE TABLE public.account +( + id uuid DEFAULT public.uuid_generate_v4() PRIMARY KEY NOT NULL, + account varchar(100) NOT NULL, + password varchar(200) NOT NULL, + ctime timestamp with time zone DEFAULT current_timestamp NOT NULL, + mtime timestamp with time zone DEFAULT current_timestamp NOT NULL +); \ No newline at end of file diff --git a/20180816-1.sql b/20180816-1.sql new file mode 100644 index 0000000..7691850 --- /dev/null +++ b/20180816-1.sql @@ -0,0 +1,3 @@ +ALTER TABLE public.donate_progres RENAME TO donate_setting; +ALTER TABLE public.donate_list RENAME TO opay_donate_list; +ALTER TABLE public.donate_setting ADD type varchar(100) DEFAULT '' NOT NULL; \ No newline at end of file diff --git a/20180826-1.sql b/20180826-1.sql new file mode 100644 index 0000000..537886f --- /dev/null +++ b/20180826-1.sql @@ -0,0 +1 @@ +ALTER TABLE public.donate_setting ADD start_amount int DEFAULT 0 NOT NULL; \ No newline at end of file diff --git a/20180828-1.sql b/20180828-1.sql new file mode 100644 index 0000000..d26f0cf --- /dev/null +++ b/20180828-1.sql @@ -0,0 +1,21 @@ +CREATE TABLE public.line_user +( + id varchar(256) PRIMARY KEY NOT NULL, + name varchar(512) NOT NULL, + ctime timestamp with time zone DEFAULT current_timestamp NOT NULL, + mtime timestamp with time zone DEFAULT current_timestamp NOT NULL +); + +CREATE TABLE public.line_message_log +( + "group" varchar(256) NOT NULL, + "user" varchar(256) NOT NULL, + message varchar(2048) DEFAULT '' NOT NULL, + ctime timestamp with time zone DEFAULT current_timestamp NOT NULL, + mtime timestamp with time zone DEFAULT current_timestamp NOT NULL, + CONSTRAINT line_message_log_line_group_id_fk FOREIGN KEY ("group") REFERENCES public.line_group (id) ON DELETE CASCADE, + CONSTRAINT line_message_log_line_user_id_fk FOREIGN KEY ("user") REFERENCES public.line_user (id) ON DELETE CASCADE +); + +ALTER TABLE public.line_message_log ADD id uuid DEFAULT public.uuid_generate_v4() NOT NULL; +ALTER TABLE public.line_message_log ADD CONSTRAINT line_message_log_pk PRIMARY KEY (id); \ No newline at end of file diff --git a/dbVersion.json b/dbVersion.json new file mode 100644 index 0000000..f483ccf --- /dev/null +++ b/dbVersion.json @@ -0,0 +1,23 @@ +{ + "versions":[ + {"file": "main.sql", "version": 1}, + {"file": "20180628-1.sql", "version": 2}, + {"file": "20180628-2.sql", "version": 3}, + {"file": "20180702-1.sql", "version": 4}, + {"file": "20180706-1.sql", "version": 5}, + {"file": "20180710-1.sql", "version": 6}, + {"file": "20180711-1.sql", "version": 7}, + {"file": "20180712-1.sql", "version": 8}, + {"file": "20180716-1.sql", "version": 9}, + {"file": "20180718-1.sql", "version": 10}, + {"file": "20180719-1.sql", "version": 11}, + {"file": "20180721-1.sql", "version": 12}, + {"file": "20180807-1.sql", "version": 13}, + {"file": "20180811-1.sql", "version": 14}, + {"file": "20180815-1.sql", "version": 15}, + {"file": "20180816-1.sql", "version": 16}, + {"file": "20180826-1.sql", "version": 17}, + {"file": "20180828-1.sql", "version": 18} + ], + "test": [] +} \ No newline at end of file diff --git a/main.sql b/main.sql new file mode 100644 index 0000000..53272c6 --- /dev/null +++ b/main.sql @@ -0,0 +1,232 @@ +-- +-- PostgreSQL database dump +-- + +-- 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; + +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; +DROP INDEX IF EXISTS public.line_group_name_uindex; +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; +ALTER TABLE IF EXISTS ONLY public.line_group DROP CONSTRAINT IF EXISTS line_group_pkey; +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; +DROP TABLE IF EXISTS public.twitch_channel; +DROP TABLE IF EXISTS public.line_twitch_rt; +DROP TABLE IF EXISTS public.line_group; +DROP TABLE IF EXISTS public.line_fb_rt; +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'; + + +SET search_path = public, pg_catalog; + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: facebook_page; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE facebook_page ( + id character varying(200) NOT NULL, + 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 +); + + +-- +-- Name: line_fb_rt; Type: TABLE; Schema: public; Owner: - +-- + +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 +); + + +-- +-- Name: line_group; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE line_group ( + id character varying(100) NOT NULL, + name character varying(200) NOT NULL, + notify boolean DEFAULT false NOT NULL, + 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 +); + + +-- +-- 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 +); + + +-- +-- Name: twitch_channel; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE twitch_channel ( + id character varying(100) NOT NULL, + name character varying(200) NOT NULL, + type 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 +); + + +-- +-- Name: version_ctrl; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE version_ctrl ( + version integer NOT NULL, + ctime timestamp with time zone DEFAULT now() NOT NULL, + querystr text DEFAULT ''::character varying NOT NULL +); + + +-- +-- Name: facebook_page facebook_page_id_pk; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY facebook_page + ADD CONSTRAINT facebook_page_id_pk PRIMARY KEY (id); + + +-- +-- Name: line_fb_rt line_fb_rt_facebook_line_pk; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY line_fb_rt + ADD CONSTRAINT line_fb_rt_facebook_line_pk PRIMARY KEY (facebook, line); + + +-- +-- Name: line_group line_group_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY line_group + ADD CONSTRAINT line_group_pkey PRIMARY KEY (id); + + +-- +-- Name: line_twitch_rt line_twitch_rt_line_twitch_pk; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY line_twitch_rt + ADD CONSTRAINT line_twitch_rt_line_twitch_pk PRIMARY KEY (line, twitch); + + +-- +-- Name: twitch_channel twitch_channel_id_pk; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY twitch_channel + ADD CONSTRAINT twitch_channel_id_pk PRIMARY KEY (id); + + +-- +-- Name: line_group_name_uindex; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX line_group_name_uindex ON line_group USING btree (name); + + +-- +-- Name: line_fb_rt line_fb_rt_facebook_page_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +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; + + +-- +-- Name: line_fb_rt line_fb_rt_line_group_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +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; + + +-- +-- Name: line_twitch_rt line_twitch_rt_line_group_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +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; + + +-- +-- Name: line_twitch_rt line_twitch_rt_twitch_channel_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +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 +-- +