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
| Method | Endpoint | Description |
|---|---|---|
| GET | /repo-connections | List |
| GET | /repo-connections/:id | Single |
| POST | /repo-connections | Create |
| PUT | /repo-connections/:id | Update |
| DELETE | /repo-connections/:id | Delete |
| POST | /repo-connections/:id/test | Test connectivity (no writes) |
| POST | /repo-connections/test-config | Validate a config payload before saving |
| POST | /repo-connections/:id/pull | Pull scripts into DB DevOps as migration records |
| POST | /repo-connections/:id/browse | List files matching file_pattern without importing |
POST /api/db-devops/repo-connections
Common fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name |
provider | string | Yes | github, gitlab, bitbucket, azure_devops, s3, azure_blob, gcs, dropbox |
config | object | Yes | Provider-specific credentials (below) |
default_branch | string | No | SCM only (e.g. main); ignored for storage |
release_path | string | No | Path/prefix for release scripts |
adhoc_path | string | No | Path/prefix for ad-hoc scripts |
file_pattern | string | No | Glob 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" } ] }