openreplay/ee/scripts/schema/db/init_dbs/postgresql/1.9.5/1.9.5.sql
2022-11-30 16:54:42 +01:00

35 lines
No EOL
1.2 KiB
PL/PgSQL

BEGIN;
CREATE OR REPLACE FUNCTION openreplay_version()
RETURNS text AS
$$
SELECT 'v1.9.5-ee'
$$ LANGUAGE sql IMMUTABLE;
CREATE TABLE IF NOT EXISTS assist_records
(
record_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY,
project_id integer NOT NULL REFERENCES projects (project_id) ON DELETE CASCADE,
user_id integer NOT NULL REFERENCES users (user_id) ON DELETE SET NULL,
session_id bigint NOT NULL REFERENCES sessions (session_id) ON DELETE SET NULL,
created_at bigint NOT NULL DEFAULT (EXTRACT(EPOCH FROM now() at time zone 'utc') * 1000)::bigint,
deleted_at timestamp without time zone NULL DEFAULT NULL,
name text NOT NULL,
file_key text NOT NULL,
duration integer NOT NULL
);
ALTER TYPE webhook_type ADD VALUE IF NOT EXISTS 'msteams';
DELETE
FROM metrics
WHERE is_predefined
AND is_template
AND metric_type = 'predefined';
-- TODO: transform metric_type to text
-- TODO: drop metric_type enum
-- TODO: drop is_pinned
-- TODO: drop is_predefined
-- TODO: drop is_template
COMMIT;