mirror of
https://github.com/block/buzz.git
synced 2026-10-30 05:51:46 +00:00
Contract step for BUZZ-315. Migration 0061 drops the 32 community_write_fence_* triggers (partition clones follow) and the five fence-only functions: enforce_community_write_fence, attach_community_write_fence, community_write_fence_excluded_table, community_write_allowed and assert_community_write_allowed. It runs under SET LOCAL lock_timeout = '5s' so the AccessExclusive DDL cannot queue serving traffic indefinitely. The desired-state schema, reconcile script and migration source assertions follow. New inventories leave the legacy fenced_tables snapshot empty, and the live-fence catalog reader is deleted. community_deletion_lock_key and the community tombstone stay. Deploy gate: merge only after the app-side admission PR, the tenant-admitted fleet sweeps and the fence-object tolerance PR are deployed on every pod, with no rollback below them expected. Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz>
24 lines
1.1 KiB
SQL
24 lines
1.1 KiB
SQL
CREATE TRIGGER events_enqueue_push_match
|
|
AFTER INSERT ON events
|
|
FOR EACH ROW EXECUTE FUNCTION enqueue_push_match_job();
|
|
|
|
CREATE CONSTRAINT TRIGGER events_refresh_channel_ttl
|
|
AFTER INSERT ON events
|
|
DEFERRABLE INITIALLY DEFERRED
|
|
FOR EACH ROW EXECUTE FUNCTION refresh_channel_ttl_after_event_insert();
|
|
CREATE TRIGGER trg_events_guard_channel_roster_snapshot
|
|
BEFORE INSERT ON events
|
|
FOR EACH ROW EXECUTE FUNCTION guard_channel_roster_snapshot();
|
|
|
|
-- INSERT OR UPDATE OF: an UPDATE can move a previously exempt row into the
|
|
-- guarded set (channel_id NULL -> NOT NULL) or move a channel row's
|
|
-- created_at below the fence, so both mutation paths re-run the guard on the
|
|
-- NEW row. A created_at rewrite that crosses partition bounds runs as
|
|
-- DELETE + INSERT and hits the cloned AFTER INSERT guard on the destination
|
|
-- partition; an in-partition rewrite fires the UPDATE OF arm.
|
|
CREATE CONSTRAINT TRIGGER events_created_at_floor
|
|
AFTER INSERT OR UPDATE OF created_at, channel_id ON events
|
|
DEFERRABLE INITIALLY DEFERRED
|
|
FOR EACH ROW
|
|
EXECUTE FUNCTION events_created_at_floor_guard();
|