Repository Connections API

Manages links to source-control and object-storage providers so DB DevOps can pull migration scripts from your existing repositories and buckets. Base path /api/db-devops/repo-connections, Professional+ tier, authenticated. Provider tokens/keys are stored in the encrypted config blob and never returned in cleartext.

Endpoints

MethodEndpointDescription
GET/repo-connectionsList
GET/repo-connections/:idSingle
POST/repo-connectionsCreate
PUT/repo-connections/:idUpdate
DELETE/repo-connections/:idDelete
POST/repo-connections/:id/testTest connectivity (no writes)
POST/repo-connections/test-configValidate a config payload before saving
POST/repo-connections/:id/pullPull scripts into DB DevOps as migration records
POST/repo-connections/:id/browseList files matching file_pattern without importing

POST /api/db-devops/repo-connections

Common fields

FieldTypeRequiredDescription
namestringYesDisplay name
providerstringYesgithub, gitlab, bitbucket, azure_devops, s3, azure_blob, gcs, dropbox
configobjectYesProvider-specific credentials (below)
default_branchstringNoSCM only (e.g. main); ignored for storage
release_pathstringNoPath/prefix for release scripts
adhoc_pathstringNoPath/prefix for ad-hoc scripts
file_patternstringNoGlob for script files (default *.sql)

Provider config schemas

GitHub

curl -X POST http://localhost:5002/api/db-devops/repo-connections \\
  -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" \\
  -d '{ "name": "Production GitHub", "provider": "github",
        "config": { "token": "GITHUB_PAT", "owner": "my-org", "repo": "db-migrations" },
        "default_branch": "main", "release_path": "migrations/release",
        "adhoc_path": "migrations/adhoc", "file_pattern": "*.sql" }'

token (PAT with repo scope), owner, repo — all required.

GitLab

{ "provider": "gitlab",
  "config": { "token": "GITLAB_PAT", "project_id": "12345678", "base_url": "https://gitlab.com" } }

token (read_repository), project_id required; base_url optional for self-hosted.

Bitbucket

{ "provider": "bitbucket",
  "config": { "username": "my-user", "app_password": "APP_PW",
              "workspace": "my-workspace", "repo_slug": "db-migrations" } }

Azure DevOps

{ "provider": "azure_devops",
  "config": { "token": "ADO_PAT", "organization": "my-org",
              "project": "my-project", "repository": "db-migrations" } }

token needs Code (Read) scope.

Amazon S3

{ "provider": "s3",
  "config": { "accessKeyId": "AKIA...", "secretAccessKey": "...",
              "region": "us-east-1", "bucket": "my-db-migrations" } }

Azure Blob Storage

{ "provider": "azure_blob",
  "config": { "connectionString": "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...",
              "container": "db-migrations" } }

Google Cloud Storage

{ "provider": "gcs",
  "config": { "projectId": "my-gcp-project", "credentials": "{...service account JSON...}",
              "bucket": "my-db-migrations" } }

Dropbox

{ "provider": "dropbox", "config": { "accessToken": "sl.xxxxxxxx" } }

For Dropbox, release_path/adhoc_path are account folder paths (e.g. /migrations/release).

Test, pull, browse

// POST /repo-connections/:id/test
{ "success": true,  "message": "Connection to GitHub repository my-org/db-migrations successful" }
{ "success": false, "message": "Authentication failed: Bad credentials" }

// POST /repo-connections/:id/pull  (imports matching files; new -> draft scripts, changed -> updated)
{ "synced": 5, "created": 3, "updated": 2, "skipped": 0, "errors": [] }

// POST /repo-connections/:id/browse  (lists without importing)
{ "files": [
    { "path": "migrations/release/001_create_users.sql", "size": 1024, "lastModified": "2025-01-10T10:00:00Z" },
    { "path": "migrations/adhoc/fix_data_2025.sql",     "size": 2048, "lastModified": "2025-01-14T09:00:00Z" } ] }