Skip to content

chore: implement database crud for AI seat usage#22681

Merged
Emyrk merged 1 commit into
mainfrom
stevenmasley/ai_seats_crud
Mar 16, 2026
Merged

chore: implement database crud for AI seat usage#22681
Emyrk merged 1 commit into
mainfrom
stevenmasley/ai_seats_crud

Conversation

@Emyrk
Copy link
Copy Markdown
Member

@Emyrk Emyrk commented Mar 5, 2026

Creates a new table ai_seat_state to keep track of when users consume an ai_seat. Once a user consumes an AI seat, they will forever in this table (as it stands today).

CREATE TABLE ai_seat_state (
    user_id uuid NOT NULL,
    first_used_at timestamp with time zone NOT NULL,
    last_used_at timestamp with time zone NOT NULL,
    last_event_type ai_seat_usage_reason NOT NULL,
    last_event_description text NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

Copy link
Copy Markdown
Member Author

Emyrk commented Mar 5, 2026

@Emyrk Emyrk force-pushed the stevenmasley/ai_seats_crud branch from c6a32c9 to 23f2238 Compare March 5, 2026 18:36
@Emyrk Emyrk force-pushed the stevenmasley/ai_seats_crud branch 5 times, most recently from a5a74c3 to e563220 Compare March 5, 2026 22:34
@Emyrk Emyrk force-pushed the stevenmasley/ai_seats_crud branch 2 times, most recently from 4b4cd29 to dd4605d Compare March 11, 2026 01:08
@Emyrk Emyrk marked this pull request as ready for review March 11, 2026 01:08
@Emyrk Emyrk force-pushed the stevenmasley/ai_seats_crud branch 3 times, most recently from 844f670 to fe47143 Compare March 11, 2026 17:31
@Emyrk Emyrk requested a review from deansheather March 11, 2026 18:35
Comment on lines +9 to +11
last_used_at timestamptz NOT NULL,
last_event_type ai_seat_usage_reason NOT NULL,
last_event_description text NOT NULL,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the goal of all of these last_* columns? I could see the use for last_used_at for determining if a seat is still in use, but the last_event_* columns seem a bit superfluous and would be better suited by an audit log entry.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The audit log only records when a user first consumes an AI seat. Not subsequent AI event usage. These last* columns are just visibility and lightweight activity tracking.

There was some UX conversations on how to show what users are consuming the AI seats. In that view, it would be beneficial to show how recently, or how long ago, the user used an AI feature. "User last used an AI feature [3 weeks ago / Today]".

When implementing that "activity" request, it felt only natural to also indicate what the event was.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine for now if that's the case

@Emyrk Emyrk force-pushed the stevenmasley/ai_seats_crud branch from fe47143 to 9e07704 Compare March 16, 2026 16:26
@Emyrk Emyrk force-pushed the stevenmasley/ai_seats_crud branch from 9e07704 to c3ce378 Compare March 16, 2026 16:27
@Emyrk Emyrk merged commit cabb611 into main Mar 16, 2026
25 of 26 checks passed
@Emyrk Emyrk deleted the stevenmasley/ai_seats_crud branch March 16, 2026 16:53
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants