docs: pg init sql (#1142)
Co-authored-by: tanxiao <tanxiao@asiainfo.com>
This commit is contained in:
parent
d0ce4c25e5
commit
e4e48cfda0
|
@ -43,9 +43,11 @@ CREATE INDEX user_group_update_at_idx ON user_group (update_at);
|
||||||
insert into user_group(id, name, create_at, create_by, update_at, update_by) values(1, 'demo-root-group', date_part('epoch',current_timestamp)::int, 'root', date_part('epoch',current_timestamp)::int, 'root');
|
insert into user_group(id, name, create_at, create_by, update_at, update_by) values(1, 'demo-root-group', date_part('epoch',current_timestamp)::int, 'root', date_part('epoch',current_timestamp)::int, 'root');
|
||||||
|
|
||||||
CREATE TABLE user_group_member (
|
CREATE TABLE user_group_member (
|
||||||
|
id bigserial,
|
||||||
group_id bigint not null,
|
group_id bigint not null,
|
||||||
user_id bigint not null
|
user_id bigint not null
|
||||||
) ;
|
) ;
|
||||||
|
ALTER TABLE user_group_member ADD CONSTRAINT user_group_member_pk PRIMARY KEY (id);
|
||||||
CREATE INDEX user_group_member_group_id_idx ON user_group_member (group_id);
|
CREATE INDEX user_group_member_group_id_idx ON user_group_member (group_id);
|
||||||
CREATE INDEX user_group_member_user_id_idx ON user_group_member (user_id);
|
CREATE INDEX user_group_member_user_id_idx ON user_group_member (user_id);
|
||||||
|
|
||||||
|
@ -72,9 +74,11 @@ insert into role(name, note) values('Standard', 'Ordinary user role');
|
||||||
insert into role(name, note) values('Guest', 'Readonly user role');
|
insert into role(name, note) values('Guest', 'Readonly user role');
|
||||||
|
|
||||||
CREATE TABLE role_operation(
|
CREATE TABLE role_operation(
|
||||||
|
id bigserial,
|
||||||
role_name varchar(128) not null,
|
role_name varchar(128) not null,
|
||||||
operation varchar(191) not null
|
operation varchar(191) not null
|
||||||
) ;
|
) ;
|
||||||
|
ALTER TABLE role_operation ADD CONSTRAINT role_operation_pk PRIMARY KEY (id);
|
||||||
CREATE INDEX role_operation_role_name_idx ON role_operation (role_name);
|
CREATE INDEX role_operation_role_name_idx ON role_operation (role_name);
|
||||||
CREATE INDEX role_operation_operation_idx ON role_operation (operation);
|
CREATE INDEX role_operation_operation_idx ON role_operation (operation);
|
||||||
|
|
||||||
|
@ -259,6 +263,7 @@ CREATE INDEX chart_share_create_at_idx ON chart_share (create_at);
|
||||||
CREATE TABLE alert_rule (
|
CREATE TABLE alert_rule (
|
||||||
id bigserial NOT NULL,
|
id bigserial NOT NULL,
|
||||||
group_id int8 NOT NULL DEFAULT 0,
|
group_id int8 NOT NULL DEFAULT 0,
|
||||||
|
cate varchar(128) not null default '' ,
|
||||||
"cluster" varchar(128) NOT NULL,
|
"cluster" varchar(128) NOT NULL,
|
||||||
"name" varchar(255) NOT NULL,
|
"name" varchar(255) NOT NULL,
|
||||||
note varchar(1024) NOT NULL,
|
note varchar(1024) NOT NULL,
|
||||||
|
@ -314,6 +319,7 @@ COMMENT ON COLUMN alert_rule.append_tags IS 'split by space: service=n9e mod=api
|
||||||
CREATE TABLE alert_mute (
|
CREATE TABLE alert_mute (
|
||||||
id bigserial,
|
id bigserial,
|
||||||
group_id bigint not null default 0 ,
|
group_id bigint not null default 0 ,
|
||||||
|
cate varchar(128) not null default '' ,
|
||||||
prod varchar(255) NOT NULL DEFAULT '' ,
|
prod varchar(255) NOT NULL DEFAULT '' ,
|
||||||
cluster varchar(128) not null,
|
cluster varchar(128) not null,
|
||||||
tags varchar(4096) not null default '' ,
|
tags varchar(4096) not null default '' ,
|
||||||
|
@ -334,6 +340,7 @@ COMMENT ON COLUMN alert_mute.etime IS 'end time';
|
||||||
CREATE TABLE alert_subscribe (
|
CREATE TABLE alert_subscribe (
|
||||||
id bigserial,
|
id bigserial,
|
||||||
group_id bigint not null default 0 ,
|
group_id bigint not null default 0 ,
|
||||||
|
cate varchar(128) not null default '' ,
|
||||||
cluster varchar(128) not null,
|
cluster varchar(128) not null,
|
||||||
rule_id bigint not null default 0,
|
rule_id bigint not null default 0,
|
||||||
tags jsonb not null ,
|
tags jsonb not null ,
|
||||||
|
@ -416,6 +423,7 @@ insert into alert_aggr_view(name, rule, cate) values('By RuleName', 'field:rule_
|
||||||
|
|
||||||
CREATE TABLE alert_cur_event (
|
CREATE TABLE alert_cur_event (
|
||||||
id bigserial NOT NULL,
|
id bigserial NOT NULL,
|
||||||
|
cate varchar(128) not null default '' ,
|
||||||
"cluster" varchar(128) NOT NULL,
|
"cluster" varchar(128) NOT NULL,
|
||||||
group_id int8 NOT NULL,
|
group_id int8 NOT NULL,
|
||||||
group_name varchar(255) NOT NULL DEFAULT ''::character varying,
|
group_name varchar(255) NOT NULL DEFAULT ''::character varying,
|
||||||
|
@ -469,6 +477,7 @@ COMMENT ON COLUMN alert_cur_event.tags IS 'merge data_tags rule_tags, split by ,
|
||||||
CREATE TABLE alert_his_event (
|
CREATE TABLE alert_his_event (
|
||||||
id bigserial NOT NULL,
|
id bigserial NOT NULL,
|
||||||
is_recovered int2 NOT NULL,
|
is_recovered int2 NOT NULL,
|
||||||
|
cate varchar(128) not null default '' ,
|
||||||
"cluster" varchar(128) NOT NULL,
|
"cluster" varchar(128) NOT NULL,
|
||||||
group_id int8 NOT NULL,
|
group_id int8 NOT NULL,
|
||||||
group_name varchar(255) NOT NULL DEFAULT ''::character varying,
|
group_name varchar(255) NOT NULL DEFAULT ''::character varying,
|
||||||
|
|
Loading…
Reference in New Issue