Skip to content

feat: backfill user_id on webhooks and forwarding_rules - #12

Merged
bmc08gt merged 1 commit into
mainfrom
feat/backfill-user-id-webhooks-rules
Oct 2, 2026
Merged

bmc08gt merged 1 commit into
mainfrom
feat/backfill-user-id-webhooks-rules

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 2, 2026

Copy link
Copy Markdown
Member

Step 2 of blip-cloud's docs/plans/user-owned-resources.md. #11 added a user_id column to webhooks and forwarding_rules; this fills it from the owning session's sessions.user_id.

Two UPDATEs go at the end of Migrations.migrations. Each only matches rows with user_id IS NULL whose session has a user_id, so:

  • rows from anonymous sessions stay NULL;
  • a user_id that's already set isn't overwritten;
  • after the first boot, later boots match nothing.

Nothing reads the column yet, so this changes no behaviour. Steps 3 and 4 start writing and reading it.

MigrationsSqlTest gets two tests. One covers a signed-in and an anonymous session, each with a webhook and a rule; it failed before the change. The other checks that an existing user_id is kept.

Step 2 of the user-ownership plan. Copies sessions.user_id onto each
webhook and forwarding rule whose session is signed in. Rows from
anonymous sessions stay NULL, and a user_id that's already set is left
alone.

The UPDATEs run with the other migrations on every boot. They only
match rows that still need a value, so after the first boot they
change nothing.
@bmc08gt bmc08gt self-assigned this Oct 2, 2026
@bmc08gt
bmc08gt merged commit 867afce into main Oct 2, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the feat/backfill-user-id-webhooks-rules branch October 2, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant