Add info into database to track api or token usage

This commit is contained in:
ldestailleur 2025-07-29 12:51:42 +02:00
parent c791ea205e
commit f9a72ba2ac
2 changed files with 11 additions and 1 deletions

View file

@ -49,4 +49,10 @@ ALTER TABLE llx_commande ADD COLUMN user_agent varchar(255);
ALTER TABLE llx_c_currencies ADD COLUMN max_decimal_unit tinyint NULL; -- Number of decimal in this currency for unit prices
ALTER TABLE llx_c_currencies ADD COLUMN max_decimal_tot tinyint NULL; -- Number of decimal in this currency for total prices
ALTER TABLE llx_oauth_token ADD COLUMN lastaccess datetime NULL; -- updated at each api access
ALTER TABLE llx_oauth_token ADD COLUMN apicount_previous_month BIGINT UNSIGNED DEFAULT 0;
ALTER TABLE llx_oauth_token ADD COLUMN apicount_month BIGINT UNSIGNED DEFAULT 0; -- increased by 1 at each page access, saved into pageviews_previous_month when on different month than lastaccess
ALTER TABLE llx_oauth_token ADD COLUMN apicount_total BIGINT UNSIGNED DEFAULT 0; -- increased by 1 at each page access, no reset
-- end of migration

View file

@ -27,5 +27,9 @@ CREATE TABLE llx_oauth_token (
restricted_ips varchar(200), -- Restrict the authentication mode/token to some IPs
datec datetime DEFAULT NULL, -- date creation project
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
entity integer DEFAULT 1
entity integer DEFAULT 1,
lastaccess datetime NULL, -- updated at each api access
apicount_previous_month BIGINT UNSIGNED DEFAULT 0,
apicount_month BIGINT UNSIGNED DEFAULT 0, -- increased by 1 at each page access, saved into pageviews_previous_month when on different month than lastaccess
apicount_total BIGINT UNSIGNED DEFAULT 0 -- increased by 1 at each page access, no reset
)ENGINE=innodb;