Skip to content

Commit fe1d085

Browse files
committed
chore(backend): create migration for session targeting rules tables
1 parent a06fd17 commit fe1d085

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-- migrate:up
2+
create table if not exists measure.session_targeting_rules (
3+
team_id uuid not null,
4+
app_id uuid not null,
5+
id uuid not null,
6+
name text not null,
7+
status integer not null check (status IN (0, 1)),
8+
sampling_rate integer not null check (sampling_rate >= 0 AND sampling_rate <= 100),
9+
rule text not null,
10+
created_at timestamptz not null default now(),
11+
created_by uuid not null,
12+
updated_at timestamptz not null default now(),
13+
updated_by uuid not null,
14+
primary key (team_id, app_id, id)
15+
);
16+
17+
comment on table measure.session_targeting_rules is 'table storing session targeting rules';
18+
comment on column measure.session_targeting_rules.team_id is 'id of team to which the rule belongs';
19+
comment on column measure.session_targeting_rules.app_id is 'app_id of the app to which the rule belongs';
20+
comment on column measure.session_targeting_rules.id is 'id of the rule';
21+
comment on column measure.session_targeting_rules.name is 'name of the rule';
22+
comment on column measure.session_targeting_rules.status is 'whether the rule is active or not';
23+
comment on column measure.session_targeting_rules.sampling_rate is 'the percentage sampling rate applied';
24+
comment on column measure.session_targeting_rules.rule is 'the rule represented as a CEL expression';
25+
comment on column measure.session_targeting_rules.created_at is 'utc timestamp at the time of rule creation';
26+
comment on column measure.session_targeting_rules.created_by is ' id of the user who created the rule';
27+
comment on column measure.session_targeting_rules.updated_at is 'utc timestamp at the time of rule update';
28+
comment on column measure.session_targeting_rules.updated_by is 'id of the user who updated the rule';
29+
30+
-- migrate:down
31+
drop table if exists measure.session_targeting_rules;

0 commit comments

Comments
 (0)