clickhouse sync project permissions and notifications#1263
clickhouse sync project permissions and notifications#1263BilalG1 wants to merge 1 commit intoclickhouse-sync-session-replaysfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR extends the ClickHouse / external-DB sync pipeline to cover two new entity types: project-level user permissions ( Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant API as API Handler
participant PG as Postgres (internal)
participant SEQ as Sequencer (cron)
participant SYNC as ExternalDB Sync Worker
participant EXT as External DB (Postgres / ClickHouse)
note over API,EXT: Grant / Update flow
API->>PG: upsert ProjectUserDirectPermission<br/>withExternalDbSyncUpdate → shouldUpdateSequenceId=true
API->>PG: upsert UserNotificationPreference<br/>withExternalDbSyncUpdate → shouldUpdateSequenceId=true
SEQ->>PG: CTE: SELECT id WHERE shouldUpdateSequenceId=TRUE FOR UPDATE SKIP LOCKED
SEQ->>PG: UPDATE SET sequenceId=nextval(), shouldUpdateSequenceId=FALSE
SEQ->>SYNC: enqueueExternalDbSyncBatch(tenancyIds)
SYNC->>PG: internalDbFetchQuery (active rows UNION deleted rows)<br/>WHERE sequence_id > last_synced
SYNC->>EXT: externalDbUpdateQuery (upsert / delete row + update _stack_sync_metadata)
note over API,EXT: Revoke / Delete flow
API->>PG: recordExternalDbSyncDeletion → INSERT into DeletedRow<br/>(ProjectUserDirectPermission or UserNotificationPreference)
API->>PG: DELETE from source table (cascade or explicit)
SEQ->>PG: CTE: SELECT id FROM DeletedRow WHERE shouldUpdateSequenceId=TRUE
SEQ->>PG: UPDATE DeletedRow SET sequenceId=nextval()
SEQ->>SYNC: enqueueExternalDbSyncBatch(tenancyIds)
SYNC->>PG: internalDbFetchQuery (deleted rows branch)
SYNC->>EXT: externalDbUpdateQuery (DELETE from target table)
|
No description provided.