21 lines
976 B
SQL
21 lines
976 B
SQL
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); |