Skip to content
This repository was archived by the owner on Aug 7, 2026. It is now read-only.

refactor: deprecate two-step postgres_changes API for OnPostgresChange - #78

Merged
Tr00d merged 1 commit into
masterfrom
deprecation
Aug 6, 2026
Merged

refactor: deprecate two-step postgres_changes API for OnPostgresChange#78
Tr00d merged 1 commit into
masterfrom
deprecation

Conversation

@Tr00d

@Tr00d Tr00d commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What

Deprecates the two-step postgres_changes registration API in favor of
OnPostgresChange (added in an earlier PR), which registers the option and
binds the handler in one call.

  • [Obsolete("Favor OnPostgresChange instead.")] on RealtimeChannel.Register(PostgresChangesOptions)
    and AddPostgresChangeHandler, plus their IRealtimeChannel declarations.
  • Client.Channel(database, schema, table, …) registers through an internal
    seam (RegisterPostgresChangesOptions) instead of the now-obsolete public
    Register, so the library itself stays CS0618-free.
  • In-repo callers (tests + Examples/) moved onto OnPostgresChange to keep
    the zero-new-warnings bar.
  • MIGRATION_v8.md records the deprecation and its replacement.

Why

OnPostgresChange supersedes the Register(...) + AddPostgresChangeHandler(...)
pairing (and the bare AddPostgresChangeHandler on an auto-* channel). Steering
callers there with a compile-time [Obsolete] is the deprecation half of that
migration, deferred out of the additive PR so the two land cleanly.

// before
channel.Register(new PostgresChangesOptions("public", "todos", ListenType.Inserts, filter));
channel.AddPostgresChangeHandler(ListenType.Inserts, handler);
// after
channel.OnPostgresChange(handler, ListenType.Inserts,
    new PostgresChangesFilter { Table = "todos", Filter = filter });

Not a removal

The methods still work — [Obsolete] is a compile-time warning only. Removal is
planned for the next major (v8), tracked in MIGRATION_v8.md.

Scope

Deliberately limited to the postgres_changes handler API. The draft #54 also
obsoleted PostgresChangesOptions.Parameters and the multi-param Channel(...)
overload; both are tangled (the Parameters ctor path, the channel-naming work)
and are left as separate follow-ups.

Relationship to #54

Fourth PR derived from the stale draft #54. #54 added the [Obsolete] markers but
left every in-repo caller emitting CS0618; this migrates them so the change is
actually warning-clean under our gate.

Testing

  • Migrated postgres_changes tests exercise the same delivery behavior through
    OnPostgresChange; full realtime suite green.
  • Clean build, zero new warnings; no known-vulnerable deps introduced.

Mark Register(PostgresChangesOptions) and AddPostgresChangeHandler
[Obsolete], pointing at OnPostgresChange, which registers the option and
binds the handler in a single call. Route Client's internal registration
through a non-obsolete seam, and move in-repo callers (tests, Examples)
onto OnPostgresChange so the tree stays warning-clean.
@Tr00d
Tr00d merged commit 91a8126 into master Aug 6, 2026
1 check passed
@Tr00d
Tr00d deleted the deprecation branch August 6, 2026 13:27
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.

1 participant