|
1 | 1 | create table if not exists user_stats_aggregate ( |
2 | 2 | user_id int not null, |
3 | 3 | window_type text not null check (window_type in ( |
4 | | - 'daily', 'weekly', 'monthly', 'yearly', |
5 | | - 'rolling_24h', 'rolling_7d', 'rolling_30d', 'rolling_365d' |
| 4 | + 'daily', 'weekly', 'monthly', 'yearly' |
6 | 5 | )), |
7 | 6 | window_start timestamptz not null, |
8 | 7 | window_end timestamptz not null, |
@@ -35,8 +34,29 @@ create table if not exists user_stats_rolling ( |
35 | 34 | ); |
36 | 35 |
|
37 | 36 | create table if not exists user_project_stats_aggregate ( |
| 37 | + user_id integer, |
| 38 | + project_path varchar(500) not null, |
38 | 39 | project_id int primary key, |
39 | | - window_type text not null check (window_type in ('day', 'week', 'month', 'year', 'last day', 'last week', 'last month', 'last year', 'all_time')), |
| 40 | + window_type text not null check (window_type in ( |
| 41 | + 'daily', 'weekly', 'monthly', 'yearly' |
| 42 | + )), |
| 43 | + window_start timestamp not null, |
| 44 | + window_end timestamp not null, |
| 45 | + lang_durations jsonb, |
| 46 | + machine_durations jsonb, |
| 47 | + editor_durations jsonb, |
| 48 | + activity_durations jsonb, |
| 49 | + files_durations jsonb, |
| 50 | + updated_at timestamptz default now() |
| 51 | +); |
| 52 | + |
| 53 | +create table if not exists user_project_stats_rolling ( |
| 54 | + user_id integer, |
| 55 | + project_path varchar(500) not null, |
| 56 | + project_id int primary key, |
| 57 | + window_type text not null check (window_type in ( |
| 58 | + 'rolling_24h', 'rolling_7d', 'rolling_30d', 'rolling_365d' |
| 59 | + )), |
40 | 60 | window_start timestamp not null, |
41 | 61 | window_end timestamp not null, |
42 | 62 | lang_durations jsonb, |
|
0 commit comments