From 7928d0598bd06bf11305b543d3f1b4c20e3975dc Mon Sep 17 00:00:00 2001 From: JayChen Date: Tue, 25 Jun 2019 17:02:39 +0800 Subject: [PATCH] add sql --- 20190625-1.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 20190625-1.sql diff --git a/20190625-1.sql b/20190625-1.sql new file mode 100644 index 0000000..fcca795 --- /dev/null +++ b/20190625-1.sql @@ -0,0 +1,15 @@ +-- create line bot table +CREATE TABLE public.line_bot ( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + "name" varchar(32) NOT NULL, + access_token varchar(256) NOT NULL, + secret varchar(256) NOT NULL, + ctime timestamptz NOT NULL DEFAULT current_timestamp, + mtime timestamptz NOT NULL DEFAULT current_timestamp, + CONSTRAINT line_bot_pk PRIMARY KEY (id) +); + +-- add bot fk to line_group table +ALTER TABLE public.line_group ADD bot_id uuid NULL; +-- add fk +ALTER TABLE public.line_group ADD CONSTRAINT line_group_fk FOREIGN KEY (bot_id) REFERENCES public.line_bot(id) ON DELETE SET NULL;