Batch Change
Bytebase allows you to change a collection of databases in a single workflow. These databases usually have a homogenous structure while belonging to different development environments, geographic locations, SaaS tenants, data centers or data partitions.
Change databases from multiple environments
A development pipeline usually consists of multiple environments. Each environment has its isolated database to store the respective data. A schema change will be propagated from each database following the development pipeline. You may have multiple databases in one stage as well.
In Bytebase, you can select multiple databases from different environments to apply the database change.
Then Bytebase will then create an issue to track the multi-database changes. You may roll out changes one database after another or batch rollout databases at the same stage.
Database group
If you always change a fixed set of databases together, you can pre-define a database group
to enclose those databases. Typical scenarios of using database group are:
- A Software as a Service (SaaS) provider provides separate database instances for each of its customers (aka. tenants) alongside their application deployments.
- For compliance and performance reasons, companies provision separate database instances in US, EU, AP respectively.
- For scaling, companies create partitioned databases.
Create a database group
-
Within a project, click Database > Groups on the left-side bar. Then click New database group to create a new database group.
-
Fill in the name and rules for filtering the desired databases.
If you want to use a database label as a filter condition, you may use raw expression with the following structure:
Where resource.labels.YOUR_LABEL_KEY == "YOUR_LABEL_VALUE" and has(resource.labels.YOUR_LABEL_KEY)
-
Click Save, you'll see the newly created group in the list.
Batch change databases in a group
-
Within the project, click Database > Groups on the left-side bar. Click Edit Schema, choose Database Group, select the database group you'll operate and click Next.
-
An issue with the selected databases will be previewed. Add the SQL in the text field and click Create. The issue is created and waiting for approval.