31 lines
859 B
MySQL
31 lines
859 B
MySQL
|
-- create table
|
||
|
CREATE TABLE IF NOT EXISTS public."Log"
|
||
|
(
|
||
|
"ID" BIGSERIAL,
|
||
|
"App" character(4) NOT NULL,
|
||
|
"Client" character varying(64) NOT NULL,
|
||
|
"Timestamp" timestamp without time zone NOT NULL DEFAULT now(),
|
||
|
"Message" text NOT NULL,
|
||
|
"Misc" text,
|
||
|
"Stack" text
|
||
|
);
|
||
|
|
||
|
-- create view
|
||
|
CREATE OR REPLACE VIEW public."LogView" AS
|
||
|
SELECT 'Timestamp'::text AS "Timestamp",
|
||
|
'App'::bpchar AS "App",
|
||
|
'Client'::character varying AS "Client",
|
||
|
'Message'::text AS "Message",
|
||
|
'Misc'::text AS "Misc",
|
||
|
'Stack'::text AS "Stack",
|
||
|
'0'::bigint AS "ID"
|
||
|
UNION ALL
|
||
|
SELECT COALESCE(to_char("Log"."Timestamp", 'YYYY-MM-DD HH24:MI:SS'::text), ''::text) AS "Timestamp",
|
||
|
"Log"."App",
|
||
|
"Log"."Client",
|
||
|
"Log"."Message",
|
||
|
"Log"."Misc",
|
||
|
"Log"."Stack",
|
||
|
"Log"."ID"
|
||
|
FROM "Log"
|
||
|
ORDER BY 7;
|