Add bridge backend for sync
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
7
pkg/coredata/migrations/20260129T120000Z.sql
Normal file
7
pkg/coredata/migrations/20260129T120000Z.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Add sync tracking fields to iam_scim_bridges table
|
||||
ALTER TABLE iam_scim_bridges ADD COLUMN last_synced_at TIMESTAMP WITH TIME ZONE;
|
||||
ALTER TABLE iam_scim_bridges ADD COLUMN next_sync_at TIMESTAMP WITH TIME ZONE DEFAULT NOW();
|
||||
ALTER TABLE iam_scim_bridges ADD COLUMN sync_error TEXT;
|
||||
|
||||
-- Create index for efficient polling of bridges due for sync
|
||||
CREATE INDEX idx_iam_scim_bridges_next_sync ON iam_scim_bridges (next_sync_at) WHERE state = 'ACTIVE';
|
||||
8
pkg/coredata/migrations/20260201T120000Z.sql
Normal file
8
pkg/coredata/migrations/20260201T120000Z.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Add failure tracking columns to iam_scim_bridges table
|
||||
ALTER TABLE iam_scim_bridges ADD COLUMN consecutive_failures INTEGER NOT NULL DEFAULT 0;
|
||||
ALTER TABLE iam_scim_bridges ADD COLUMN total_sync_count INTEGER NOT NULL DEFAULT 0;
|
||||
ALTER TABLE iam_scim_bridges ADD COLUMN total_failure_count INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
-- Drop old index and create new one that covers all processable states
|
||||
DROP INDEX IF EXISTS idx_iam_scim_bridges_next_sync;
|
||||
CREATE INDEX idx_iam_scim_bridges_next_sync ON iam_scim_bridges (next_sync_at) WHERE state IN ('ACTIVE', 'FAILED', 'SYNCING');
|
||||
Reference in New Issue
Block a user