20241008155620_create_monthly_usages.sql

 1create table monthly_usages (
 2    id serial primary key,
 3    user_id integer not null,
 4    model_id integer not null references models (id) on delete cascade,
 5    month integer not null,
 6    year integer not null,
 7    input_tokens bigint not null default 0,
 8    cache_creation_input_tokens bigint not null default 0,
 9    cache_read_input_tokens bigint not null default 0,
10    output_tokens bigint not null default 0
11);
12
13create unique index uix_monthly_usages_on_user_id_model_id_month_year on monthly_usages (user_id, model_id, month, year);