mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
RE: https://github.com/coder/coder/issues/15740, https://github.com/coder/coder/issues/15297 In order to add a graph to the coder frontend to show user status over time as an indicator of license usage, this PR adds the following: * a new `api.insightsUserStatusCountsOverTime` endpoint to the API * which calls a new `GetUserStatusCountsOverTime` query from postgres * which relies on two new tables `user_status_changes` and `user_deleted` * which are populated by a new trigger and function that tracks updates to the users table The chart itself will be added in a subsequent PR --------- Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
10 lines
300 B
SQL
10 lines
300 B
SQL
DROP TRIGGER IF EXISTS user_status_change_trigger ON users;
|
|
|
|
DROP FUNCTION IF EXISTS record_user_status_change();
|
|
|
|
DROP INDEX IF EXISTS idx_user_status_changes_changed_at;
|
|
DROP INDEX IF EXISTS idx_user_deleted_deleted_at;
|
|
|
|
DROP TABLE IF EXISTS user_status_changes;
|
|
DROP TABLE IF EXISTS user_deleted;
|