mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-25 20:32:11 +03:00
9aaedcff51
* 🗃️ Rename users table into user_daily_usage * 💥 replace User model with UserIdentity model * 🗃️ New UserDailyUsage class for database interaction * 🐛 fix daily requests rate limiting per user * 🐛 fix user stats and properties update * ✏️ add typing and linting * 🚚 rename user_dialy_usage Class into user_usage & requests_count into daily_requests_count * 🚑 fix some rebase errors
29 lines
532 B
SQL
29 lines
532 B
SQL
-- Create a new user_daily_usage table
|
|
create table if not exists
|
|
user_daily_usage (
|
|
user_id uuid references auth.users (id),
|
|
email text,
|
|
date text,
|
|
daily_requests_count int,
|
|
primary key (user_id, date)
|
|
);
|
|
|
|
-- Drop the old users table
|
|
drop table if exists users;
|
|
|
|
-- Update migrations table
|
|
insert into
|
|
migrations (name)
|
|
select
|
|
'202308181004030_rename_users_table'
|
|
where
|
|
not exists (
|
|
select
|
|
1
|
|
from
|
|
migrations
|
|
where
|
|
name = '202308181004030_rename_users_table'
|
|
);
|
|
|
|
commit; |