231 lines
6.2 KiB
MySQL
231 lines
6.2 KiB
MySQL
|
|
CREATE TABLE tenant (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
name text,
|
||
|
|
key text,
|
||
|
|
url text,
|
||
|
|
vertical text,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE grafana (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
name text,
|
||
|
|
url text,
|
||
|
|
tenant_id bigint,
|
||
|
|
status boolean DEFAULT false,
|
||
|
|
alert_id bigint,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE alerts (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
name text,
|
||
|
|
team_name text,
|
||
|
|
service_name text,
|
||
|
|
status boolean DEFAULT false,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
|
||
|
|
CREATE TABLE incidents (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
title text,
|
||
|
|
description text,
|
||
|
|
status varchar(50),
|
||
|
|
severity_id bigint,
|
||
|
|
incident_name text,
|
||
|
|
slack_channel varchar(100),
|
||
|
|
detection_time timestamp without time zone,
|
||
|
|
customer_impact_start_time timestamp without time zone,
|
||
|
|
customer_impact_end_time timestamp without time zone,
|
||
|
|
teams_id bigint,
|
||
|
|
jira_id varchar(100),
|
||
|
|
confluence_id varchar(100),
|
||
|
|
created_by varchar(100),
|
||
|
|
updated_by varchar(100),
|
||
|
|
severity_tat timestamp without time zone,
|
||
|
|
remind_me_at timestamp without time zone,
|
||
|
|
enable_reminder boolean DEFAULT false,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone,
|
||
|
|
version bigint default 0
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE teams (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
name varchar(50),
|
||
|
|
oncall_handle varchar(100),
|
||
|
|
secondary_oncall_handle varchar(100),
|
||
|
|
manager_handle varchar(100),
|
||
|
|
secondary_manager_handle varchar(100),
|
||
|
|
active boolean DEFAULT false,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE teams_severity_user_mapping (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
entity_type varchar(100),
|
||
|
|
entity_id bigint,
|
||
|
|
users_id bigint,
|
||
|
|
version bigint default 0,
|
||
|
|
default_add_in_incidents boolean DEFAULT false,
|
||
|
|
team_role varchar(100),
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
|
||
|
|
CREATE TABLE users (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
name varchar(50),
|
||
|
|
slack_user_id varchar(100),
|
||
|
|
active boolean DEFAULT true
|
||
|
|
);
|
||
|
|
|
||
|
|
|
||
|
|
CREATE TABLE severity (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
name varchar(50),
|
||
|
|
description text,
|
||
|
|
version bigint default 0,
|
||
|
|
sla int,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE teams_tags_mapping (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
teams_id bigint,
|
||
|
|
tag_id bigint,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE incidents_tags_mapping (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
incident_id bigint,
|
||
|
|
tag_id bigint,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE incidents_tags_contributing_factor_mapping (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
incident_id bigint,
|
||
|
|
contributing_factor_id bigint,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE contributing_factor (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
label varchar(100),
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE incidents_tags_customer_mapping (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
incident_id bigint,
|
||
|
|
customer_tags_id bigint,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE customer_tags (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
label varchar(100),
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE incidents_tags_data_platform_mapping (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
incident_id bigint,
|
||
|
|
data_platform_tag text,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE tags (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
label text,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE incident_status (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
name varchar(50),
|
||
|
|
description text,
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE incident_roles (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
incident_id bigint,
|
||
|
|
role varchar(100),
|
||
|
|
assigned_to_user_slack_id varchar(100),
|
||
|
|
assigned_by_user_slack_id varchar(100),
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE messages (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
slack_channel varchar(100),
|
||
|
|
incident_name text,
|
||
|
|
message_timestamp varchar(100),
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE TABLE audit (
|
||
|
|
id SERIAL PRIMARY KEY,
|
||
|
|
incident_id bigint,
|
||
|
|
event text,
|
||
|
|
user_name varchar(100),
|
||
|
|
user_id varchar(100),
|
||
|
|
version bigint default 0,
|
||
|
|
created_at timestamp without time zone,
|
||
|
|
updated_at timestamp without time zone,
|
||
|
|
deleted_at timestamp without time zone
|
||
|
|
);
|