feat(DB): changed creation script
This commit is contained in:
parent
86d4f5c2a6
commit
7c60d52c09
2 changed files with 30 additions and 29 deletions
|
|
@ -497,21 +497,6 @@ $$
|
|||
CREATE INDEX IF NOT EXISTS user_viewed_errors_user_id_idx ON public.user_viewed_errors (user_id);
|
||||
CREATE INDEX IF NOT EXISTS user_viewed_errors_error_id_idx ON public.user_viewed_errors (error_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS errors_tags
|
||||
(
|
||||
key text NOT NULL,
|
||||
value text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL default (now() at time zone 'utc'),
|
||||
error_id text NOT NULL REFERENCES errors (error_id) ON DELETE CASCADE,
|
||||
session_id bigint NOT NULL,
|
||||
message_id bigint NOT NULL,
|
||||
FOREIGN KEY (session_id, message_id) REFERENCES events.errors (session_id, message_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS errors_tags_error_id_idx ON errors_tags (error_id);
|
||||
CREATE INDEX IF NOT EXISTS errors_tags_session_id_idx ON errors_tags (session_id);
|
||||
CREATE INDEX IF NOT EXISTS errors_tags_message_id_idx ON errors_tags (message_id);
|
||||
|
||||
IF NOT EXISTS(SELECT *
|
||||
FROM pg_type typ
|
||||
WHERE typ.typname = 'platform') THEN
|
||||
|
|
@ -1033,6 +1018,21 @@ $$
|
|||
CREATE INDEX IF NOT EXISTS errors_error_id_timestamp_session_id_idx ON events.errors (error_id, timestamp, session_id);
|
||||
CREATE INDEX IF NOT EXISTS errors_error_id_idx ON events.errors (error_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS errors_tags
|
||||
(
|
||||
key text NOT NULL,
|
||||
value text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL default (now() at time zone 'utc'),
|
||||
error_id text NOT NULL REFERENCES errors (error_id) ON DELETE CASCADE,
|
||||
session_id bigint NOT NULL,
|
||||
message_id bigint NOT NULL,
|
||||
FOREIGN KEY (session_id, message_id) REFERENCES events.errors (session_id, message_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS errors_tags_error_id_idx ON errors_tags (error_id);
|
||||
CREATE INDEX IF NOT EXISTS errors_tags_session_id_idx ON errors_tags (session_id);
|
||||
CREATE INDEX IF NOT EXISTS errors_tags_message_id_idx ON errors_tags (message_id);
|
||||
|
||||
IF NOT EXISTS(SELECT *
|
||||
FROM pg_type typ
|
||||
WHERE typ.typname = 'http_method') THEN
|
||||
|
|
|
|||
|
|
@ -405,20 +405,6 @@ $$
|
|||
CREATE INDEX user_viewed_errors_user_id_idx ON public.user_viewed_errors (user_id);
|
||||
CREATE INDEX user_viewed_errors_error_id_idx ON public.user_viewed_errors (error_id);
|
||||
|
||||
CREATE TABLE errors_tags
|
||||
(
|
||||
key text NOT NULL,
|
||||
value text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL default (now() at time zone 'utc'),
|
||||
error_id text NOT NULL REFERENCES errors (error_id) ON DELETE CASCADE,
|
||||
session_id bigint NOT NULL,
|
||||
message_id bigint NOT NULL,
|
||||
FOREIGN KEY (session_id, message_id) REFERENCES events.errors (session_id, message_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX errors_tags_error_id_idx ON errors_tags (error_id);
|
||||
CREATE INDEX errors_tags_session_id_idx ON errors_tags (session_id);
|
||||
CREATE INDEX errors_tags_message_id_idx ON errors_tags (message_id);
|
||||
|
||||
-- --- sessions.sql ---
|
||||
CREATE TYPE device_type AS ENUM ('desktop', 'tablet', 'mobile', 'other');
|
||||
|
|
@ -750,6 +736,21 @@ $$
|
|||
CREATE INDEX errors_error_id_timestamp_session_id_idx ON events.errors (error_id, timestamp, session_id);
|
||||
CREATE INDEX errors_error_id_idx ON events.errors (error_id);
|
||||
|
||||
CREATE TABLE errors_tags
|
||||
(
|
||||
key text NOT NULL,
|
||||
value text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL default (now() at time zone 'utc'),
|
||||
error_id text NOT NULL REFERENCES errors (error_id) ON DELETE CASCADE,
|
||||
session_id bigint NOT NULL,
|
||||
message_id bigint NOT NULL,
|
||||
FOREIGN KEY (session_id, message_id) REFERENCES events.errors (session_id, message_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX errors_tags_error_id_idx ON errors_tags (error_id);
|
||||
CREATE INDEX errors_tags_session_id_idx ON errors_tags (session_id);
|
||||
CREATE INDEX errors_tags_message_id_idx ON errors_tags (message_id);
|
||||
|
||||
CREATE TABLE events.graphql
|
||||
(
|
||||
session_id bigint NOT NULL REFERENCES sessions (session_id) ON DELETE CASCADE,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue