This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/database/migrations/021_team_providers.sql
2026-02-22 16:52:19 +00:00

17 lines
810 B
SQL

-- ==========================================
-- Migration 021: Team Providers
-- ==========================================
-- Adds team_id to api_configs, enabling teams to have their own
-- provider configs managed by team admins.
--
-- Provider hierarchy: global (user_id IS NULL, is_global=true)
-- → team (team_id IS NOT NULL)
-- → personal (user_id IS NOT NULL)
-- ==========================================
-- Add team_id FK to api_configs
ALTER TABLE api_configs ADD COLUMN IF NOT EXISTS team_id UUID REFERENCES teams(id) ON DELETE CASCADE;
CREATE INDEX IF NOT EXISTS idx_api_configs_team ON api_configs(team_id) WHERE team_id IS NOT NULL;
COMMENT ON COLUMN api_configs.team_id IS 'Team-scoped provider — managed by team admins, visible to team members';