32 lines
925 B
MySQL
Raw Permalink Normal View History

2019-08-29 11:35:53 +02:00
-- drop view to remove dependencies
DROP VIEW public."LogView";
2019-07-04 12:21:37 +02:00
2019-08-29 11:35:53 +02:00
-- add type column
ALTER TABLE public."Log"
ADD COLUMN "Type" character varying(64) NOT NULL DEFAULT 'Error';
-- change app column to varying 64
ALTER TABLE public."Log"
ALTER COLUMN "App" TYPE character varying(64);
-- recreate view
2019-07-04 12:21:37 +02:00
CREATE OR REPLACE VIEW public."LogView" AS
SELECT 'Timestamp'::text AS "Timestamp",
2019-08-29 11:35:53 +02:00
'App'::character varying AS "App",
'Type'::character varying AS "Type",
2019-07-04 12:21:37 +02:00
'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",
2019-08-29 11:35:53 +02:00
"Log"."Type",
2019-07-04 12:21:37 +02:00
"Log"."Client",
"Log"."Message",
"Log"."Misc",
"Log"."Stack",
"Log"."ID"
FROM "Log"
2019-08-29 11:35:53 +02:00
ORDER BY 8;