make submodule

This commit is contained in:
Jay 2018-09-19 20:22:33 +08:00
commit 33f8a1dc6e
19 changed files with 389 additions and 0 deletions

2
20180628-1.sql Normal file
View File

@ -0,0 +1,2 @@
ALTER TABLE public.twitch_channel DROP type;
ALTER TABLE public.line_twitch_rt ADD type varchar(100) DEFAULT '' NOT NULL;

1
20180628-2.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE public.twitch_channel ADD laststream varchar(100) DEFAULT '' NOT NULL;

19
20180702-1.sql Normal file
View File

@ -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(), '');

29
20180706-1.sql Normal file
View File

@ -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)
);

2
20180710-1.sql Normal file
View File

@ -0,0 +1,2 @@
insert into "public"."commands" ("cmd", "message", "ctime", "mtime", "group") values
('addyoutube', '{{addyoutube}}', now(), now(), '');

2
20180711-1.sql Normal file
View File

@ -0,0 +1,2 @@
ALTER TABLE public.commands DROP CONSTRAINT commands_pkey;
ALTER TABLE public.commands ADD CONSTRAINT commands_pkey PRIMARY KEY (cmd, "group");

11
20180712-1.sql Normal file
View File

@ -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")
);

2
20180716-1.sql Normal file
View File

@ -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;

1
20180718-1.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE public.youtube_channel ALTER COLUMN expire TYPE bigint USING expire::bigint;

16
20180719-1.sql Normal file
View File

@ -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
);

3
20180721-1.sql Normal file
View File

@ -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;

2
20180807-1.sql Normal file
View File

@ -0,0 +1,2 @@
insert into "public"."commands" ("cmd", "message", "ctime", "mtime", "group") values
('roll', '{{roll}}', now(), now(), '');

11
20180811-1.sql Normal file
View File

@ -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
);

8
20180815-1.sql Normal file
View File

@ -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
);

3
20180816-1.sql Normal file
View File

@ -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;

1
20180826-1.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE public.donate_setting ADD start_amount int DEFAULT 0 NOT NULL;

21
20180828-1.sql Normal file
View File

@ -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);

23
dbVersion.json Normal file
View File

@ -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": []
}

232
main.sql Normal file
View File

@ -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
--