|
2 | 2 | title: Overview |
3 | 3 | --- |
4 | 4 |
|
5 | | -Bytebase offers a database-as-code workflow, enabling you to manage database changes directly through your version control system (VCS). |
| 5 | +## Goal |
6 | 6 |
|
7 | | -Bytebase provides pre-built actions for popular CI/CD platforms. For custom requirements, you can build your own pipeline using the [Bytebase API](/integrations/api/overview). |
| 7 | +GitOps for database CI/CD brings the same rigor and automation used in application development to database schema management. Database schema changes are equivalent to API changes in microservices - they define contracts between services, and misalignment can break production systems. |
8 | 8 |
|
9 | | -## Capabilities |
| 9 | +By treating databases as dependencies that require versioning, compatibility management, and progressive rollout strategies, schema changes gain the same safety and predictability as application code. |
10 | 10 |
|
11 | | -Bytebase GitOps integration provides two core capabilities: |
| 11 | +## Why Database Schema Changes Matter |
12 | 12 |
|
13 | | -### Versioned Database Migrations |
| 13 | +Database schema changes are fundamentally similar to API changes: |
| 14 | +- They define contracts between services |
| 15 | +- Breaking changes can cause application failures |
| 16 | +- They require versioning and compatibility considerations |
| 17 | +- They benefit from progressive rollout and feature flagging |
14 | 18 |
|
15 | | -- **Database-as-code workflow** - Manage database changes through your VCS just like application code |
16 | | -- **Schema and data changes** - Support for both DDL (CREATE/ALTER/DROP tables, indexes) and DML (INSERT/UPDATE/DELETE) operations |
17 | | -- **Change detection** - Automatically detects and skips already applied migrations, ensuring idempotency |
18 | | -- **Progressive deployments** - Automated rollout across environments (test → staging → production) |
19 | | -- **Multi-database support** - Apply changes across multiple databases with batch operations |
| 19 | +Bytebase enables database-as-code workflows, allowing you to manage database changes through your version control system (VCS) with the same process and confidence as application code. |
20 | 20 |
|
| 21 | +## Core Capabilities |
21 | 22 |
|
22 | | -## GitOps Workflow |
| 23 | +### Database-as-Code Workflow |
23 | 24 |
|
24 | | -### 1. Development Phase |
| 25 | +- **Unified CI/CD Pipeline** - Integrate database changes seamlessly into your existing CI/CD workflows |
| 26 | +- **Version Control Integration** - Manage schema changes alongside application code in your VCS |
| 27 | +- **Automated Change Detection** - Intelligently detect and apply only necessary changes, ensuring idempotency |
| 28 | +- **Progressive Deployment** - Roll out changes across environments (development → staging → production) with configurable automation and approval gates |
25 | 29 |
|
26 | | -Developers create SQL migration files in their feature branches. |
| 30 | +### Enterprise-Grade Safety |
27 | 31 |
|
28 | | -### 2. Review Phase (Pull Request) |
| 32 | +- **SQL Review and Validation** - Automatic policy enforcement during pull requests |
| 33 | +- **Rollback Capabilities** - Support for safe schema rollbacks when needed |
| 34 | +- **Multi-Region Support** - Deploy to isolated regional databases with separate or unified Bytebase deployments |
| 35 | +- **Batch Operations** - Apply changes across multiple databases consistently |
29 | 36 |
|
30 | | -- SQL review runs automatically on the PR |
31 | | -- Validates changes against configured policies |
32 | | -- No release created yet - only validation |
| 37 | +## GitOps Workflow |
33 | 38 |
|
34 | | -### 3. Release Creation (Merge) |
| 39 | +### 1. Development Phase |
| 40 | + |
| 41 | +Developers create SQL migration files in feature branches, following the same branch management strategy as application code (e.g., [GitHub Flow](https://docs.github.com/en/get-started/quickstart/github-flow), [GitLab Flow](https://about.gitlab.com/blog/gitlab-flow-duo/)). |
35 | 42 |
|
36 | | -When the PR is merged to main: |
| 43 | +### 2. Review Phase (Pull Request) |
37 | 44 |
|
38 | | -- GitOps integration automatically creates a new release |
39 | | -- All SQL files from the merge are packaged together |
40 | | -- Release is assigned a unique identifier |
41 | | -- Linked to the merge commit for traceability |
| 45 | +- Automated SQL review validates changes against configured policies |
| 46 | +- Schema changes are reviewed alongside application code changes |
| 47 | +- Compatibility checks ensure schema and code alignment |
42 | 48 |
|
43 | | -### 4. Progressive Deployment |
| 49 | +### 3. Release Creation and Deployment |
44 | 50 |
|
45 | | -The release follows your configured deployment pipeline: |
| 51 | +After PR merge, releases can be created and deployed according to your workflow, consistent with application code deployment: |
46 | 52 |
|
47 | | -- **Test Environment**: Automatic deployment after creation |
48 | | -- **Staging Environment**: May require manual approval |
49 | | -- **Production Environment**: Typically requires explicit approval |
50 | | -- Each deployment is tracked with timing and status |
| 53 | +- GitOps integration can create versioned releases containing SQL migrations |
| 54 | +- Releases are linked to commits for full traceability |
| 55 | +- Deployment timing is configurable based on your pipeline strategy: |
| 56 | + - **Automatic**: Deploy immediately after merge (common for development/test environments) |
| 57 | + - **Time-based**: Schedule deployments for specific windows |
| 58 | + - **Manual approval**: Require explicit approval before deployment (common for production) |
| 59 | +- Feature flags can decouple schema deployment from applications using new schema version |
51 | 60 |
|
52 | | -**Important**: When deploying a release, Bytebase automatically detects which migrations have already been applied to the target database and skips them. This ensures safe re-deployment and allows the same release to be deployed multiple times without errors. |
| 61 | +**Key Principle**: Bytebase automatically detects previously applied migrations and skips them, ensuring safe re-deployment and idempotent operations across all environments. |
0 commit comments