<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Adela</title>
    <description>The latest articles on Forem by Adela (@adela_bytebase).</description>
    <link>https://forem.com/adela_bytebase</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F770925%2F7fb08e1e-f7be-475e-9465-811787b28842.jpg</url>
      <title>Forem: Adela</title>
      <link>https://forem.com/adela_bytebase</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/adela_bytebase"/>
    <language>en</language>
    <item>
      <title>⚙️🔥 Automating Database Schema Change workflow Using GitHub Actions 🐙🚀</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Wed, 20 Mar 2024 10:20:04 +0000</pubDate>
      <link>https://forem.com/bytebase/automating-database-schema-change-workflow-using-github-actions-4838</link>
      <guid>https://forem.com/bytebase/automating-database-schema-change-workflow-using-github-actions-4838</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Tutorial repository &lt;a href="https://github.com/bytebase/ci-example" rel="noopener noreferrer"&gt;https://github.com/bytebase/ci-example&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Developers like to keep their schema migration scripts in Git along with the application code. Thus the migration scripts will be reviewed and version-controlled in the same way as the application code.&lt;br&gt;
However, developers still have to manually paste the migration script into their SQL client or ask the DBAs to run it against the target database. This is inefficient and error-prone:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What if you paste the wrong script / miss the script?&lt;/li&gt;
&lt;li&gt;What if you run the script against the wrong database?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This tutorial teaches how to get rid of this manual process and fully automate database schema change&lt;br&gt;
using GitHub Actions and Bytebase API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fworkflow.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fworkflow.webp" alt="workflow" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Above shows a typical workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Developer creates a PR containing the migration script. After PR is created, it triggers a GitHub&lt;br&gt;
Action to lint the SQL by calling Bytebase &lt;a href="https://www.bytebase.com/docs/api/sql-review/" rel="noopener noreferrer"&gt;SQL Review API&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TL approves the PR.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Upon PR approval, it triggers a GitHub Action to create a Bytebase rollout issue.&lt;br&gt;
The issue contains the migration script changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Depending on the configured &lt;a href="https://www.bytebase.com/docs/administration/custom-approval/" rel="noopener noreferrer"&gt;approval&lt;/a&gt; and &lt;a href="https://www.bytebase.com/docs/administration/environment-policy/rollout-policy/" rel="noopener noreferrer"&gt;rollout policy&lt;/a&gt;, it may require manual approval and rollout from DBA. Another GitHub Action is configured to block the PR merge until Bytebase rolls out the schema migration. Sometimes, a PR contains both code and schema changes. This setup guarantees &lt;strong&gt;the schema migration is applied before the code deployment&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bytebase deploys the schema change and marks the issue as Done.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PR re-runs the migration status check and now it turns green.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now PR can be merged.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Prepare Bytebase
&lt;/h2&gt;

&lt;p&gt;Suppose Bytebase is running at &lt;code&gt;https://bytebase.example.com/&lt;/code&gt;. To begin, we'll first set up the necessary data to support our API interactions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Service account&lt;/strong&gt;: As an admin, we add a &lt;a href="https://www.bytebase.com/docs/api/authentication/#service-account" rel="noopener noreferrer"&gt;service account&lt;/a&gt; &lt;code&gt;ci@service.bytebase.com&lt;/code&gt; with the &lt;code&gt;Workspace DBA&lt;/code&gt; role, which will be used to authenticate the API calls.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-workspace-members-ci.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-workspace-members-ci.webp" alt="bb-workspace-members-ci" width="800" height="100"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;To limit the service account permissions, you can choose to grant &lt;code&gt;Workspace Member&lt;/code&gt; instead of &lt;code&gt;Workspace DBA&lt;/code&gt;.&lt;br&gt;
   And then in the particular project, grant the account the permission to create an issue.&lt;/p&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A database in a project&lt;/strong&gt;: We have a project called &lt;code&gt;Example&lt;/code&gt;, and a database: &lt;code&gt;example&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-project-database.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-project-database.webp" alt="bb-project-database" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Prepare GitHubs Actions
&lt;/h2&gt;

&lt;p&gt;Go and check the example on GitHub &lt;a href="https://github.com/bytebase/ci-example" rel="noopener noreferrer"&gt;https://github.com/bytebase/ci-example&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The repository contains several GitHub Action workflows, you may go to &lt;code&gt;.github/workflows&lt;/code&gt; to view.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-workflows.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-workflows.webp" alt="gh-workflows" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will use the following workflows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;bytebase-sql-review.yml&lt;/code&gt;: Triggered on PR change. Thus any SQL review violation will block the PR.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bytebase-upsert-migration.yml&lt;/code&gt; Triggered on PR approval. Creates the Bytebase migration issue after approval.
And whenever the migration scripts change afterwards, the migration issue will also be updated accordingly.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bytebase-check-migration-status.yml&lt;/code&gt;: Triggered on PR change. Thus PR will be blocked until migration completes.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Sample Workflow, Four Phases
&lt;/h2&gt;

&lt;p&gt;To illustrate the workflow, we have divided it into four phases to showcase the database schema change process.&lt;/p&gt;
&lt;h3&gt;
  
  
  Phase 1: Not passing SQL review on GitHub
&lt;/h3&gt;

&lt;p&gt;Before we delve into the workflow, let's set up the SQL Review policy in Bytebase. The example database is on the &lt;code&gt;Prod&lt;/code&gt; environment, where we will configure SQL review policy. Here we have a policy that checks for &lt;code&gt;NOT NULL&lt;/code&gt; constraints, which we will violate in the PR.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-environment-sql-review.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-environment-sql-review.webp" alt="bb-environment-sql-review" width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-sql-review-policy-not-null.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-sql-review-policy-not-null.webp" alt="bb-sql-review-policy-not-null" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Returning to GitHub Actions and digging into the code, the &lt;code&gt;bytebase-sql-review.yml&lt;/code&gt; workflow is triggered on PR change. It scans the SQL files named following the pattern &lt;code&gt;**.up.sql&lt;/code&gt; in the PR and reports any SQL review policy violations.&lt;/p&gt;

&lt;p&gt;Configure the environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;   &lt;span class="na"&gt;bytebase-sql-review&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
         &lt;span class="na"&gt;BYTEBASE_URL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://bytebase-ci.zeabur.app"&lt;/span&gt;
         &lt;span class="na"&gt;BYTEBASE_SERVICE_ACCOUNT&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ci@service.bytebase.com"&lt;/span&gt;
         &lt;span class="na"&gt;DATABASE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;instances/prod-instance/databases/example"&lt;/span&gt;
   &lt;span class="s"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After authentication, we call the Bytebase API &lt;code&gt;/sql/check&lt;/code&gt; to lint the migration files. We parse the response&lt;br&gt;
and emit GitHub inline annotations for each advice and mark the check as failed if any &lt;code&gt;ERROR&lt;/code&gt; or &lt;code&gt;WARNING&lt;/code&gt; is found.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;     &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SQL Review&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Checkout&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Login to Bytebase&lt;/span&gt;
        &lt;span class="s"&gt;...&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Review&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;review&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./.github/actions/sql-review&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;github-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GITHUB_TOKEN }}&lt;/span&gt;
          &lt;span class="na"&gt;pattern&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**/*.up.sql"&lt;/span&gt;
          &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ env.BYTEBASE_URL }}&lt;/span&gt;
          &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ steps.login.outputs.token }}&lt;/span&gt;
          &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{"Accept-Encoding":&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"deflate,&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;gzip"}'&lt;/span&gt;
          &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ env.DATABASE }}&lt;/span&gt;
      &lt;span class="s"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We create a &lt;a href="https://github.com/bytebase/github-action-example/pull/15" rel="noopener noreferrer"&gt;PR&lt;/a&gt; with several SQL files, and it triggers both &lt;code&gt;bytebase-sql-review.yml&lt;/code&gt; and &lt;code&gt;bytebase-check-migration-status.yml&lt;/code&gt;. After these checks are completed, the PR is blocked due to failures.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-pr1-blocked.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-pr1-blocked.webp" alt="gh-pr1-blocked" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the &lt;strong&gt;Details&lt;/strong&gt; for SQL Review.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-sql-review-warning.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-sql-review-warning.webp" alt="gh-sql-review-warning" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may also go to &lt;strong&gt;Files changed&lt;/strong&gt; to view the annotations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-sql-review-warning-file-annotation.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-sql-review-warning-file-annotation.webp" alt="gh-sql-review-warning-file-annotation" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Phase 2: Passing SQL review and waiting for TL's approval on GitHub
&lt;/h3&gt;

&lt;p&gt;We then fix the SQL files and pushes. After completing these checks, the PR is still blocked due to failures, but this time SQL review has passed.&lt;/p&gt;

&lt;p&gt;In real-life scenarios, the PR also encompasses application code. Because the SQL migration has passed the basic SQL review checks, it is now time for a tech leader to &lt;strong&gt;approve&lt;/strong&gt; this PR.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-waiting-for-approval.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-waiting-for-approval.webp" alt="gh-waiting-for-approval" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The developer who creates the PR assigns the tech leader to review on GitHub.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-add-reviewers.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-add-reviewers.webp" alt="gh-add-reviewers" width="712" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Phase 3: TL approves on GitHub and migration issue is created in Bytebase
&lt;/h3&gt;

&lt;p&gt;The assigned tech leader approves the PR, and another workflow &lt;code&gt;bytebase-upsert-migration.yml&lt;/code&gt; is triggered.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-waiting-for-check.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-waiting-for-check.webp" alt="gh-waiting-for-check" width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It checks the SQL files named like &lt;code&gt;**.up.sql&lt;/code&gt; within the pull request and creates a rollout issue in Bytebase.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;   &lt;span class="na"&gt;bytebase-upsert-migration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="c1"&gt;# Runs only if PR is approved and target branch is main&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github.event.review.state == 'approved' &amp;amp;&amp;amp; github.event.pull_request.base.ref == 'main'&lt;/span&gt;
    &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;BYTEBASE_URL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://bytebase-ci.zeabur.app"&lt;/span&gt;
      &lt;span class="na"&gt;BYTEBASE_SERVICE_ACCOUNT&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ci@service.bytebase.com"&lt;/span&gt;
      &lt;span class="na"&gt;PROJECT&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;example"&lt;/span&gt;
      &lt;span class="na"&gt;DATABASE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;instances/prod-instance/databases/example"&lt;/span&gt;
      &lt;span class="na"&gt;ISSUE_TITLE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.repository&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}#${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.event.pull_request.number&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}]&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.event.pull_request.title&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;DESCRIPTION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Triggered&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;by&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.event.repository.html_url&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}/pull/${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.event.pull_request.number&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.event.pull_request.title&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Upsert Migration&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="s"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to Bytebase and view the created issue, which consists of two tasks corresponding to the presence of two &lt;code&gt;**.up.sql&lt;/code&gt; files in the PR.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-issue-user-post.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-issue-user-post.webp" alt="bb-issue-user-post" width="800" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may notice there is an approval flow attached to the created issue, that's because we set up a default &lt;a href="https://www.bytebase.com/docs/administration/custom-approval/" rel="noopener noreferrer"&gt;custom approval flow for DDL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-custom-approval.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-custom-approval.webp" alt="bb-custom-approval" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Phase 4: Migration completed and PR is mergable on GitHub
&lt;/h3&gt;

&lt;p&gt;After the DBA approves and rolls out the migrations, the issue status will become &lt;code&gt;Done&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-issue-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fbb-issue-done.webp" alt="bb-issue-done" width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go back to GitHub, click &lt;strong&gt;Details&lt;/strong&gt; for the failed &lt;code&gt;bytebase-check-migration-status.yml&lt;/code&gt; workflow, and then click &lt;strong&gt;Re-run all jobs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-pr2-blocked.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-pr2-blocked.webp" alt="gh-pr2-blocked" width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-re-run.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-re-run.webp" alt="gh-re-run" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It checks the migration status in Bytebase and return &lt;code&gt;pass&lt;/code&gt; if it's &lt;code&gt;Done&lt;/code&gt;, indicating the database migration has been completed. The PR is now ready to be merged, which means the application code is ready to be deployed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-re-run-pass.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-re-run-pass.webp" alt="gh-re-run-pass" width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-all-pass-ready-merge.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fgithub-ci%2Fgh-all-pass-ready-merge.webp" alt="gh-all-pass-ready-merge" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Keep in mind that workflows can be tuned according to your organization's needs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;You can attach the workflow to different branches depending on your branching strategy (e.g. trunk-based or not).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can use different migration file formats and different migration file structures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can determine when to create the migration issue, upon PR approval or creation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Whatever workflow you choose, with the help of GitHub Actions and Bytebase API, you can now keep your migration scripts in the repository, let the migration scripts go through the same code review process and automate the schema migration deployment.&lt;/p&gt;

</description>
      <category>gitops</category>
      <category>devops</category>
      <category>database</category>
      <category>github</category>
    </item>
    <item>
      <title>🔄 How to Synchronize Database Schemas🔥🚀</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Fri, 01 Mar 2024 10:21:45 +0000</pubDate>
      <link>https://forem.com/bytebase/how-to-synchronize-database-schemas-j9l</link>
      <guid>https://forem.com/bytebase/how-to-synchronize-database-schemas-j9l</guid>
      <description>&lt;p&gt;This tutorial will walk you through the typical use cases for &lt;strong&gt;database schema synchronization&lt;/strong&gt; in Bytebase with &lt;strong&gt;pure UI operations&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Sync Schema&lt;/strong&gt; feature in Bytebase supports copying a specific schema version from one database to multiple others. Without it, developers have to write SQL statements cautiously and apply them manually. Additionally, this feature may also be used for rollback purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparation
&lt;/h2&gt;

&lt;p&gt;Make sure you installed &lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy and paste the commands to start one Bytebase via Docker.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   docker run --init \
   --name bytebase \
   --publish 8080:8080 \
   --volume ~/.bytebase/data:/var/opt/bytebase \
   bytebase/bytebase:%%bb_version%%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Register and sign in &lt;strong&gt;Bytebase Console&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Case 1 - Sync Schema to a New Database
&lt;/h2&gt;

&lt;p&gt;When you set up a new environment or find the current database is nearing capacity, it becomes necessary to establish a new database and synchronize the schema from the original database.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go into &lt;code&gt;Sample Project&lt;/code&gt;, there are two databases &lt;code&gt;hr_test&lt;/code&gt; on &lt;code&gt;Test&lt;/code&gt; environment and &lt;code&gt;hr_prod&lt;/code&gt; on &lt;code&gt;Prod&lt;/code&gt; environment. Let's create another one on &lt;code&gt;Prod&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;New DB&lt;/strong&gt;, fill in the form as follows and click &lt;strong&gt;Create&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: &lt;code&gt;hr_prod_2&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment&lt;/strong&gt;: &lt;code&gt;Prod&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance&lt;/strong&gt;: &lt;code&gt;Prod Sample Instance&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database owner name&lt;/strong&gt;: &lt;code&gt;bbsample&lt;/code&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-new-db-prod-2.webp" alt="bb-new-db-prod-2" width="800" height="375"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An issue will be created and executed automatically, and the database &lt;code&gt;hr_prod_2&lt;/code&gt; will be ready when the issue is &lt;code&gt;Done&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-new-db-prod-2-issue.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-new-db-prod-2-issue.webp" alt="bb-new-db-prod-2-issue" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Within the project, click &lt;strong&gt;Sync Schema&lt;/strong&gt;, choose &lt;code&gt;hr_prod&lt;/code&gt; as the source schema, and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-source.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-source.webp" alt="bb-sync-schema-source" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You may select as many target databases as you like to sync to. Here we select all (including the source) and click &lt;strong&gt;Select&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-all-selected.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-all-selected.webp" alt="bb-sync-schema-all-selected" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bytebase will calculate the schema differences between the source and target databases, and generate the suggested DDL statements. Click &lt;strong&gt;Preview Issue&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-before-preview.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-before-preview.webp" alt="bb-sync-schema-before-preview" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An issue with the generated DDL is created automatically. Click &lt;strong&gt;Rollout&lt;/strong&gt; ignoring the SQL review warning. After the issue execution is &lt;code&gt;Done&lt;/code&gt;, the schema synchronization is completed.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-issue-rollout-anyway.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-issue-rollout-anyway.webp" alt="bb-issue-rollout-anyway" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Case 2 - Sync Schema from One to Many
&lt;/h2&gt;

&lt;p&gt;During the product release process, for different environments, such as dev, staging and prod, you'll need to do schema synchronization. Furthermore, for the prod environment, databases with identical schemas, such as SaaS, and multi-region game deployment, you may also need to sync the schema to multiple databases at the same time.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Within the project, select &lt;code&gt;hr_test&lt;/code&gt; and click &lt;strong&gt;Edit Schema&lt;/strong&gt;. With the help of Schema Editor, add a new column &lt;code&gt;email&lt;/code&gt; as follows and click &lt;strong&gt;Preview issue&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: &lt;code&gt;email&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type&lt;/strong&gt;: &lt;code&gt;text&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default&lt;/strong&gt;: &lt;code&gt;Empty string&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not Null&lt;/strong&gt;: &lt;code&gt;checked&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-schema-editor-email.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-schema-editor-email.webp" alt="bb-schema-editor-email" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;An issue is created and executed automatically. After it's &lt;code&gt;Done&lt;/code&gt;, the new column &lt;code&gt;email&lt;/code&gt; is added.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-issue-add-email-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-issue-add-email-done.webp" alt="bb-issue-add-email-done" width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Within the project, click &lt;strong&gt;Sync Schema&lt;/strong&gt;, choose &lt;code&gt;hr_test&lt;/code&gt; as the source schema and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-email-source.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-email-source.webp" alt="bb-sync-schema-email-source" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;code&gt;hr_prod&lt;/code&gt; and &lt;code&gt;hr_prod_2&lt;/code&gt; as the target databases. Schema differences are calculated and the suggested DDL statements are generated. Click &lt;strong&gt;Preview issue&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-add-email.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-add-email.webp" alt="bb-sync-schema-add-email" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An issue with the generated DDL is created automatically. Because two databases need to be synced, there're two task blocks. After they execute one by one, the issue is &lt;code&gt;Done&lt;/code&gt;, and &lt;code&gt;email&lt;/code&gt; is added.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-issue-add-email-prod.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-issue-add-email-prod.webp" alt="bb-issue-add-email-prod" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Case 3 - Rollback to Previous Schema Versions
&lt;/h2&gt;

&lt;p&gt;In Bytebase &lt;strong&gt;Community Plan&lt;/strong&gt;, you can choose the latest history version; In &lt;strong&gt;Pro Plan&lt;/strong&gt; or &lt;strong&gt;Enterprise Plan&lt;/strong&gt;, you can choose an arbitrary schema version from the full migration history. Which means you can roll back to any previous schema version.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;After upgrading to &lt;strong&gt;Enterprise Plan&lt;/strong&gt;, go into &lt;code&gt;Sample Project&lt;/code&gt;, click &lt;strong&gt;Sync Schema&lt;/strong&gt; and select &lt;code&gt;hr_test&lt;/code&gt; as the source schema. When you choose the schema version, you will see the following prompt. That's because we haven't assigned the enterprise license to database instances.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-test-lock.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-test-lock.webp" alt="bb-sync-test-lock" width="800" height="303"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on the lock sign, select both two instances, and click &lt;strong&gt;Confirm&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-manage-license.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-manage-license.webp" alt="bb-manage-license" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the license is assigned, you can choose the schema version freely, we'll choose the previous version and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-prev.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-schema-prev.webp" alt="bb-sync-schema-prev" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose the same database &lt;code&gt;hr_test&lt;/code&gt; as the target, and click &lt;strong&gt;Select&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-rollback-target.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-rollback-target.webp" alt="bb-sync-rollback-target" width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bytebase will calculate the schema differences between the source and target databases, and generate the suggested DDL statements. Here means if you want to roll back to the previous version, you'll need to delete this line. Click &lt;strong&gt;Preview Issue&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-rollback-preview.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-rollback-preview.webp" alt="bb-sync-rollback-preview" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Create&lt;/strong&gt;, an issue with the generated DDL is created and rollout automatically. After the issue execution is &lt;code&gt;Done&lt;/code&gt;, the schema rolls back to the previous version.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-rollback-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-synchronize-database-schemas%2Fbb-sync-rollback-done.webp" alt="bb-sync-rollback-done" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Is the experience smooth? Or do you encounter any problems? Feel free to join our &lt;a href="https://discord.gg/huyw7gRsyA" rel="noopener noreferrer"&gt;Discord Group&lt;/a&gt; to talk about it!&lt;/p&gt;

</description>
      <category>database</category>
      <category>mysql</category>
      <category>postgres</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🛡️4 Top Database Security Tools in 2024 🏆🔥</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Thu, 01 Feb 2024 10:04:03 +0000</pubDate>
      <link>https://forem.com/bytebase/4-top-database-security-tools-22jj</link>
      <guid>https://forem.com/bytebase/4-top-database-security-tools-22jj</guid>
      <description>&lt;p&gt;In today's digital age, where data is as valuable as oil, protecting this crucial asset is essential for every organization. Threats arise from external sources like hackers and malware, as well as internal ones, including human errors and malicious insiders. This article will explore leading database security tools designed to shield your data from these varied risks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Networking - Tailscale
&lt;/li&gt;
&lt;li&gt;Database credential management - Infisical
&lt;/li&gt;
&lt;li&gt;On-demand database access - Indent
&lt;/li&gt;
&lt;li&gt;All-in-one human-to-db operation - Bytebase
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tailscale
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://tailscale.com/" rel="noopener noreferrer"&gt;Tailscale&lt;/a&gt; is a VPN service that makes the devices and applications you own accessible anywhere in the world, securely and effortlessly. It enables encrypted point-to-point connections using the open source WireGuard® protocol, which means only devices on your private network can communicate with each other.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Ftailscale-home-img.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Ftailscale-home-img.webp" alt="tailscale-home-img" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When it comes to databases, Tailscale can be used to connect to your database from any location globally, without having to expose your database to the public internet or setting up extra SSH tunnels.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Ftailscale-home-slogan.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Ftailscale-home-slogan.webp" alt="tailscale-home-slogan" width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Its free tier accommodates up to 3 users and 100 devices, which is for individuals or small businesses. For additional capabilities like Access control and Audit logs, paid plans start at $6 per user per month.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Ftailscale-pricing.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Ftailscale-pricing.webp" alt="tailscale-pricing" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Infisical
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://infisical.com/" rel="noopener noreferrer"&gt;Infisical&lt;/a&gt; is an open-source, end-to-end encrypted secret management platform for storing, managing, and syncing application configuration and secrets like API keys, database credentials, and environment variables across applications and infrastructure. It is an alternative to HashiCorp Vault and AWS Secrets Manager.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Finfisical-one-dashboard.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Finfisical-one-dashboard.webp" alt="infisical-one-dashboard" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You have the option to host Infisical on your premises or utilize their cloud offering.&lt;/p&gt;

&lt;p&gt;With its help, your database credentials can be stored in a secure vault and be accessed by your application only when needed. In this way, you can avoid storing your database credentials in your application code or configuration files. Access is facilitated through CLI, SDK, Docker, Kubernetes, or REST API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Finfisical-dashboard-secrets.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Finfisical-dashboard-secrets.webp" alt="infisical-dashboard-secrets" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The free tier supports up to 5 developers and 3 environments, catering to hobbyists. For features such as Access Controls and Audit Logs, paid plans start at $6 per developer per month.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Finfisical-pricing.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Finfisical-pricing.webp" alt="infisical-pricing" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Indent
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://indent.com/" rel="noopener noreferrer"&gt;Indent&lt;/a&gt; provides team members with on-demand access to cloud apps and infrastructure in seconds. They aptly describe this innovation as the &lt;strong&gt;request access button&lt;/strong&gt; for any software or service utilized by the company.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Findent-button.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Findent-button.webp" alt="indent-button" width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the context of database access management, Indent provides you the capability to grant time-bound, granular access to systems that handle customer data. It offers three methods of integration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zero Trust Network (ZTN) - e.g. Tailscale&lt;/li&gt;
&lt;li&gt;Identity Group - e.g. Okta&lt;/li&gt;
&lt;li&gt;Custom Integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Findent-graph.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Findent-graph.webp" alt="indent-graph" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Indent provides a secure-by-default free tier suitable for small teams on a trial basis. For those requiring more, the paid plans begin at $8 per user per month.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Findent-pricing.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Findent-pricing.webp" alt="indent-pricing" width="800" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bytebase
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://bytebase.com" rel="noopener noreferrer"&gt;Bytebase&lt;/a&gt; is an open-source database DevOps tool, it's the GitLab/GitHub for managing databases throughout the application development lifecycle. It offers a web-based collaboration workspace for DBAs, Developers and platform engineers. It consolidates disparate DB tools&lt;br&gt;
such as DBeaver, Liquibase, Flyway into a single place.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fimages%2Freplaced-tools.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fimages%2Freplaced-tools.webp" alt="replaced-tools" width="771" height="718"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It seeks to encompass all interactions between humans and databases across every database, including managing changes, querying data, handling access, and beyond. Thanks to its features such as SQL Lint, Database CI/CD, Data Access Control, Data Masking, and more, you can be confident that all your database activities are executed via standardized procedures and completely auditable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Fbb-3-op.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Fbb-3-op.webp" alt="bb-3-op" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Community Plan, you can have up to 10 users and up to 5 databases for free. For medium to large organizations, the Enterprise plan offers advanced options like Data Access Control, Audit Log, and additional features.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Fbb-pricing-995.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbytebase.com%2Fcontent%2Fblog%2Ftop-database-security-tools%2Fbb-pricing-995.webp" alt="bb-pricing-995" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In this article, we have explored four database security tools that can help you protect your database from external and internal threats. Each tool offers its unique strengths; by understanding your specific needs, you can choose the one that most aligns with your requirements.&lt;/p&gt;

</description>
      <category>database</category>
      <category>security</category>
      <category>data</category>
      <category>secops</category>
    </item>
    <item>
      <title>🐣Your First Database Schema Change in 5 Minutes with Bytebase</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Thu, 18 Jan 2024 06:42:04 +0000</pubDate>
      <link>https://forem.com/bytebase/your-first-database-schema-change-in-5-minutes-with-bytebase-44a0</link>
      <guid>https://forem.com/bytebase/your-first-database-schema-change-in-5-minutes-with-bytebase-44a0</guid>
      <description>&lt;p&gt;In this tutorial, you'll use the sample databases Bytebase provides by default to get familiar with the product in the quickest way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 - Run via Docker
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install and start &lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Open Terminal to run the command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  docker run --init \
    --name bytebase \
    --publish 8080:8080 \
    --volume ~/.bytebase/data:/var/opt/bytebase \
    bytebase/bytebase:2.13.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the Terminal shows the following message, the execution is successful.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;██████╗ ██╗   ██╗████████╗███████╗██████╗  █████╗ ███████╗███████╗
██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝
██████╔╝ ╚████╔╝    ██║   █████╗  ██████╔╝███████║███████╗█████╗
██╔══██╗  ╚██╔╝     ██║   ██╔══╝  ██╔══██╗██╔══██║╚════██║██╔══╝
██████╔╝   ██║      ██║   ███████╗██████╔╝██║  ██║███████║███████╗
╚═════╝    ╚═╝      ╚═╝   ╚══════╝╚═════╝ ╚═╝  ╚═╝╚══════╝╚══════╝

  Version 2.13.1 has started on port 8080 🚀

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you have Bytebase running in Docker.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fdk-bb-running.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fdk-bb-running.webp" alt="dk-bb-running" width="800" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open Bytebase in &lt;a href="http://localhost:8080/" rel="noopener noreferrer"&gt;localhost:8080&lt;/a&gt;, fill in the fields and click &lt;strong&gt;Create admin account&lt;/strong&gt;. You'll be redirected to the workspace.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-register.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-register.webp" alt="bb-register" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Follow the &lt;strong&gt;Quikstart&lt;/strong&gt; guide on the bottom to click around or dismiss it by now. You can click your avatar on top right and click &lt;strong&gt;Quickstart&lt;/strong&gt; on the dropdown menu to reopen it later.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-first-workspace.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-first-workspace.webp" alt="bb-first-workspace" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 - One Issue with Two Stages
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;My Issues&lt;/strong&gt; on the left sidebar, and click the issue &lt;code&gt;SAM-101&lt;/code&gt; which is created by default.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-my-issues.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-my-issues.webp" alt="bb-my-issues" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The issue is &lt;code&gt;waiting to rollout&lt;/code&gt;. There's a pipeline consisting of two stages:

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test Stage&lt;/strong&gt;: apply to database &lt;code&gt;hr_test&lt;/code&gt; on &lt;code&gt;Test Sample instance&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prod Stage&lt;/strong&gt;: apply to database &lt;code&gt;hr_prod&lt;/code&gt; on &lt;code&gt;Prod Sample instance&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;Test&lt;/code&gt; stage is &lt;code&gt;active&lt;/code&gt; by default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-test.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-test.webp" alt="bb-issue-test" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Prod Stage&lt;/strong&gt; to switch to it, and you will see the two stages share the same SQL but to different databases. You may also notice there's a warning sign for SQL review on the &lt;strong&gt;Prod&lt;/strong&gt; stage. That's because when the issue is created, Bytebase will run task checks automatically. SQL review is one of them.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-prod.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-prod.webp" alt="bb-issue-prod" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click the warning sign to see the details. If you wonder why only &lt;strong&gt;Prod Stage&lt;/strong&gt; has the warning sign, it's because by default SQL Review is only configured for &lt;code&gt;Prod&lt;/code&gt; environment. You can click the &lt;strong&gt;Settings&lt;/strong&gt; (gear) on the top right, and click &lt;strong&gt;Security &amp;amp; Policy&lt;/strong&gt; &amp;gt; &lt;strong&gt;SQL Review&lt;/strong&gt; to have a look.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-sql-review-not-null.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-sql-review-not-null.webp" alt="bb-sql-review-not-null" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 - Roll out on Test Stage
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Switch back to &lt;strong&gt;Test Stage&lt;/strong&gt; and click &lt;strong&gt;Rollout&lt;/strong&gt;. Click &lt;strong&gt;Rollout&lt;/strong&gt; on the confirmation dialog.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-test-rollout.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-test-rollout.webp" alt="bb-test-rollout" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When the SQL is applied, there will be a checkmark on the &lt;strong&gt;Test Stage&lt;/strong&gt;. Click &lt;strong&gt;View change&lt;/strong&gt; and you'll see the diff.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-test-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-test-done.webp" alt="bb-issue-test-done" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fissue-snapshot-diff.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fissue-snapshot-diff.webp" alt="issue-snapshot-diff" width="800" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4 - Roll out on Prod Stage
&lt;/h2&gt;

&lt;p&gt;There are two ways to roll out on &lt;strong&gt;Prod Stage&lt;/strong&gt; regarding the SQL review result.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you are confident with the SQL, you can click &lt;strong&gt;Rollout&lt;/strong&gt; directly. Check the &lt;strong&gt;Rollout anyway&lt;/strong&gt;, and click &lt;strong&gt;Rollout&lt;/strong&gt; on the confirmation dialog.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-prod-anyway.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-prod-anyway.webp" alt="bb-issue-prod-anyway" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Another way is to edit the SQL. Click &lt;strong&gt;Edit&lt;/strong&gt; on top of the SQL, and add the &lt;code&gt;NOT NULL&lt;/code&gt;. It will look like this:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;employee&lt;/span&gt; &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;COLUMN&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="nb"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt;, the checks will be run again. This time the SQL review will pass and it will roll out automatically. The issue will become &lt;code&gt;Done&lt;/code&gt; as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-issue-done.webp" alt="bb-issue-done" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may ask why it's rolling out automatically, it's because for &lt;strong&gt;Community Plan&lt;/strong&gt;, the rollout policy is automatic if the SQL review passes. You may go to &lt;strong&gt;Environments&lt;/strong&gt; to check.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-env-automatic.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Ffirst-schema-change%2Fbb-env-automatic.webp" alt="bb-env-automatic" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Step
&lt;/h2&gt;

&lt;p&gt;Now you have successfully performed your first schema change in Bytebase. It's the core part of Bytebase. You can continue to dig deeper by following &lt;a href="https://www.bytebase.com/docs/tutorials/deploy-schema-migration/" rel="noopener noreferrer"&gt;Deploy Schema Migration with Rollout Policy&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>database</category>
      <category>schema</category>
      <category>postgressql</category>
    </item>
    <item>
      <title>🔥Top psql Commands with Examples🐘</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Wed, 22 Nov 2023 03:10:10 +0000</pubDate>
      <link>https://forem.com/bytebase/top-psql-commands-with-examples-1h5</link>
      <guid>https://forem.com/bytebase/top-psql-commands-with-examples-1h5</guid>
      <description>&lt;p&gt;PostgreSQL, or Postgres, is a free and open-source relational database management system (RDBMS) known for its reliability, feature robustness, and performance. It has been actively developed for over 35 years and is considered one of the most advanced open-source RDBMSs available.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;psql&lt;/code&gt; is the official CLI client to command the PostgreSQL database. It supports interactive and noninteractive use.&lt;/p&gt;

&lt;p&gt;Below list of the 10 most commonly used &lt;code&gt;psql&lt;/code&gt; commands with examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Connect to a database - &lt;code&gt;psql -U xxx -p -h xxx -d xxx&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;If you are using the default PostgreSQL username &lt;code&gt;postgres&lt;/code&gt; and have not set a password, you can connect to the database using the following command. You will be prompted to enter the password for the &lt;code&gt;postgres&lt;/code&gt; user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are using a different username or have set a password for the &lt;code&gt;postgres&lt;/code&gt; user, you can connect to the database using the following command. You will be prompted to enter the password for the specified user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql -U your_username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the PostgreSQL server is running on a different port than the default (5432), you can connect to the database using the following command. You will be prompted to enter the password for the specified user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql -p 5433
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the PostgreSQL server is running on a remote host, you can connect to the database using the following command. You will be prompted to enter the password for the specified user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql -h remote_host -p 5432
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In all of these examples, you can also specify the name of the database you want to connect to using the -d option. For example, to connect to the database named my_database, you would use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql -d my_database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Run a single command - &lt;code&gt;-c&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;To run a single command in PostgreSQL using the &lt;code&gt;psql&lt;/code&gt; CLI, you can use the &lt;code&gt;-c&lt;/code&gt; option followed by the SQL command you want to execute.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql -d my_database -c "SELECT * FROM my_table;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;List available databases - &lt;code&gt;\l&lt;/code&gt;
This command will all of the databases that are currently available on the server. This can be useful for getting an overview of the databases that are available to you.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# \l

   Name    |  Owner   | Encoding | Locale Provider |  Collate   |   Ctype    | ICU Locale | ICU Rules |   Access privileges
-----------+----------+----------+-----------------+------------+------------+------------+-----------+-----------------------
 postgres  | postgres | UTF8     | libc            | en_US.utf8 | en_US.utf8 |            |           |
 template0 | postgres | UTF8     | libc            | en_US.utf8 | en_US.utf8 |            |           | =c/postgres          +
           |          |          |                 |            |            |            |           | postgres=CTc/postgres
 template1 | postgres | UTF8     | libc            | en_US.utf8 | en_US.utf8 |            |           | =c/postgres          +
           |          |          |                 |            |            |            |           | postgres=CTc/postgres
(3 rows)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Switch to a specified database - &lt;code&gt;\c&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;\c&lt;/code&gt; command switches to the specified database. This is useful for working with a specific database after you have listed the available databases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# \c postgres


psql (16.0, server 16.1 (Debian 16.1-1.pgdg120+1))
You are now connected to database "postgres" as user "postgres".
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. List tables - &lt;code&gt;\dt&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;\dt&lt;/code&gt; command lists all of the tables that are currently available in the current database. This can be useful for getting an overview of the tables that are available to you in the current database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# \dt

List of relations
Schema | Name | Type | Owner
-------+---------+-------+--------
public | mytable | table | postgres
public | users | table | postgres
public | orders | table | postgres
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Describe a specified table - &lt;code&gt;\d&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;\d&lt;/code&gt; command describes the specified table. This provides information about the table's columns, data types, and constraints.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# \d my_table

Table: my_table

Column | Data Type | Constraints
-------+------------+-------------------
id | SERIAL | PRIMARY KEY
name | VARCHAR(50) | NOT NULL
email | VARCHAR(100) | UNIQUE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Listing users - &lt;code&gt;\du&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;\du&lt;/code&gt; command lists all of the users that exist in the current database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# \du

List of roles
Role name | Attributes
---------+------------
postgres | SUPERUSER, CREATEDB, CREATEROLE, INHERIT, REPLICATION
myuser | CREATEDB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;\du username&lt;/code&gt; command is used to list the roles (users) in the current database that have the specified username.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# \du myuser

List of roles
Role name | Attributes
---------+------------
myuser | CREATEDB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the specified username does not match any roles in the current database, the output will be an empty table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# \du youruser

List of roles
Role name | Attributes
---------+------------
 |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. Show connections - &lt;code&gt;pg_stat_activity&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;To list all active connections, execute the following SQL query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# SELECT * FROM pg_stat_activity;

pid | datname | username | client_addr | client_port | backend_start | query_start | query | state
-------+---------+---------+-------------+-------------+---------------+---------------+-----------------+----------
1234 | mydb1   | postgres | 192.168.1.100 | 5432 | 2023-10-04 15:04:00 | 2023-10-04 15:04:05 | SELECT * FROM mytable; | active
5678 | mydb2   | user1    | 192.168.1.101 | 5432 | 2023-10-04 15:05:00 | 2023-10-04 15:05:03 | UPDATE mytable SET name = 'John Doe' WHERE id = 123; | idle in transaction
9012 | postgres | 192.168.1.102 | 5432 | 2023-10-04 15:06:00 |                |                | idle |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also filter the results to specific connections based on criteria such as username, database name, or state. For example, to list only active connections to the database &lt;code&gt;mydb&lt;/code&gt;, use the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# SELECT * FROM pg_stat_activity WHERE datname = 'mydb' AND state = 'active';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, to list connections currently executing queries, use the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# SELECT * FROM pg_stat_activity WHERE state IN ('active', 'idle in transaction');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  9. Kill connection - &lt;code&gt;pg_terminate_backend(), kill&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Once you have identified the PID of the connection you want to kill, you can use the &lt;code&gt;pg_terminate_backend()&lt;/code&gt; function to terminate it. For example, the following command will kill the connection with PID 1234:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# SELECT pg_terminate_backend(1234);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using the kill command is a less common method for killing PostgreSQL connections, as it can be more dangerous and less reliable than using the pg_terminate_backend() function. &lt;/p&gt;

&lt;p&gt;However, it may be necessary in certain situations, such as when the connection is unresponsive or the &lt;code&gt;pg_terminate_backend()&lt;/code&gt; function fails.&lt;/p&gt;

&lt;p&gt;kill -9 1234&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


## 10. Quit - `\q`,Ctrl+D/Ctrl+Z
Using the `\q` command or the keyboard shortcut Ctrl+D(or Ctrl+Z on Windows). This will immediately exit the `psql `CLI.👋
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>🚛 Deploy Database Schema Migrations with Bytebase</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Fri, 10 Nov 2023 07:09:31 +0000</pubDate>
      <link>https://forem.com/bytebase/deploy-schema-migration-with-bytebase-1173</link>
      <guid>https://forem.com/bytebase/deploy-schema-migration-with-bytebase-1173</guid>
      <description>&lt;p&gt;&lt;a href="https://www.bytebase.com/" rel="noopener noreferrer"&gt;Bytebase&lt;/a&gt; offers a powerful GUI for schema migration deployments. This tutorial will show you how to use Bytebase to deploy schema migrations with features like SQL Review, custom approval, time scheduling, and more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fgraph-4-steps.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fgraph-4-steps.webp" alt="graph-4-steps" width="800" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bytebase offers &lt;strong&gt;Community&lt;/strong&gt;, &lt;strong&gt;Pro&lt;/strong&gt; and &lt;strong&gt;Enterprise&lt;/strong&gt; &lt;a href="https://www.bytebase.com/pricing" rel="noopener noreferrer"&gt;Plans&lt;/a&gt;. Advanced plans&lt;br&gt;
unlock new capabilities of deploying schema migrations and this tutorial will walk you through them progressively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features covered
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Level 1 - &lt;a href="https://www.bytebase.com/docs/sql-review/overview/" rel="noopener noreferrer"&gt;Automatic SQL Review&lt;/a&gt; (available in all plans)&lt;/li&gt;
&lt;li&gt;Level 2 - &lt;a href="https://www.bytebase.com/docs/administration/environment-policy/rollout-policy/" rel="noopener noreferrer"&gt;Rollout Policy&lt;/a&gt; (available in Pro and Enterprise)&lt;/li&gt;
&lt;li&gt;Level 3 - &lt;a href="https://www.bytebase.com/docs/administration/custom-approval/" rel="noopener noreferrer"&gt;Custom Approval&lt;/a&gt; (available in Enterprise)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Preparation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Make sure your Docker is running, and start the Bytebase Docker container with the following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--restart&lt;/span&gt; always &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--publish&lt;/span&gt; 5678:8080 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-cmd&lt;/span&gt; &lt;span class="s2"&gt;"curl --fail http://localhost:5678/healthz || exit 1"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-interval&lt;/span&gt; 5m &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-timeout&lt;/span&gt; 60s &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--volume&lt;/span&gt; ~/.bytebase/data:/var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  bytebase/bytebase:%%bb_version%% &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--data&lt;/span&gt; /var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--port&lt;/span&gt; 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Bytebase is running successfully in Docker, and you can visit it via &lt;code&gt;localhost:5678&lt;/code&gt;. Register an admin account and it will be granted the &lt;code&gt;workspace owner&lt;/code&gt; role automatically.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Level 1: Automatic rollout with SQL review (Community Plan)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Environments&lt;/strong&gt; &amp;gt; &lt;strong&gt;Test&lt;/strong&gt; and &lt;strong&gt;Environments&lt;/strong&gt; &amp;gt; &lt;strong&gt;Prod&lt;/strong&gt;, you'll see

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;Rollout policy&lt;/code&gt; is &lt;code&gt;automatic&lt;/code&gt;. &lt;strong&gt;Unless there's some warning or error, the rollout will be automatically executed after the issue is created&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SQL Review&lt;/code&gt; is enabled on &lt;code&gt;Prod&lt;/code&gt; with a sample policy.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-env-rollout-automatic-test-prod.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-env-rollout-automatic-test-prod.webp" alt="bb-env-rollout-automatic-test-prod" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;code&gt;SQL Review Sample Policy&lt;/code&gt; to go to SQL Review policy, there're three rules activated. Let's pay attention to &lt;code&gt;Enforce NOT NULL constraints on columns&lt;/code&gt; rule, and we'll try to violate it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-sql-review-sample-policy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-sql-review-sample-policy.webp" alt="bb-sql-review-sample-policy" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;code&gt;Sample Project&lt;/code&gt;, click &lt;strong&gt;Edit Schema&lt;/strong&gt;, choose both &lt;code&gt;Test&lt;/code&gt; and &lt;code&gt;Prod&lt;/code&gt; databases, and click &lt;strong&gt;Next&lt;/strong&gt;. Paste the following SQL statements into &lt;strong&gt;Raw SQL&lt;/strong&gt;, and click &lt;strong&gt;Preview issue&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="nv"&gt;"public"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;"employee"&lt;/span&gt;
    &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;COLUMN&lt;/span&gt; &lt;span class="nv"&gt;"country"&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;SQL Review checks will dry run before the issue is created. Here let's create the issue regardless of the dry run result.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the issue is created, SQL Review will run automatically along with some other checks. You'll see there's a warning for the task on &lt;code&gt;Prod&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-warning-prod.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-warning-prod.webp" alt="bb-issue-warning-prod" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-sql-review-warning.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-sql-review-warning.webp" alt="bb-issue-sql-review-warning" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Edit&lt;/strong&gt;, paste this SQL statement and click &lt;strong&gt;Save&lt;/strong&gt;. Apply this change to all tasks. The SQL checks will run again, and you'll see the warning disappear and it will roll out automatically.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="nv"&gt;"public"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;"employee"&lt;/span&gt;
&lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;COLUMN&lt;/span&gt; &lt;span class="nv"&gt;"country"&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-done-free.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-done-free.webp" alt="bb-issue-done-free" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;View change&lt;/strong&gt; to see the diff or go to &lt;strong&gt;Change History&lt;/strong&gt; to view all changes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-done-show-diff.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-done-show-diff.webp" alt="bb-issue-done-show-diff" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-proj-change-list.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-proj-change-list.webp" alt="bb-proj-change-list" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 2: Manual rollout with dedicated roles and scheduled time (Pro Plan)
&lt;/h3&gt;

&lt;p&gt;With Pro Plan, you'll get two additional features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manual rollout policy. You can specify multiple pre-defined roles to manually roll out the change.&lt;/li&gt;
&lt;li&gt;Time scheduling. You can specify a particular time to roll out the change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To simplify the process, we'll use 14-day enterprise trial here. Click the &lt;strong&gt;Start free trial&lt;/strong&gt; to upgrade.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Environments&lt;/strong&gt; &amp;gt; &lt;strong&gt;Prod&lt;/strong&gt;, choose &lt;code&gt;Manual rollout by dedicated roles&lt;/code&gt; and check all the roles. Click &lt;strong&gt;Update&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-env-prod-manual.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-env-prod-manual.webp" alt="bb-env-prod-manual" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;code&gt;Sample Project&lt;/code&gt;, click &lt;strong&gt;Edit Schema&lt;/strong&gt;, choose both &lt;code&gt;Test&lt;/code&gt; and &lt;code&gt;Prod&lt;/code&gt; databases, and click &lt;strong&gt;Next&lt;/strong&gt;. Paste the following SQL statements into &lt;strong&gt;Raw SQL&lt;/strong&gt;, and click &lt;strong&gt;Preview issue&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="nv"&gt;"public"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;"employee"&lt;/span&gt;
    &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;COLUMN&lt;/span&gt; &lt;span class="nv"&gt;"city"&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt;, and after &lt;strong&gt;Task checks&lt;/strong&gt; runs, you'll see the SQL running on &lt;code&gt;Test&lt;/code&gt; automatically but waiting to run on &lt;code&gt;Prod&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-prod-waiting.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-prod-waiting.webp" alt="bb-issue-prod-waiting" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Rollout&lt;/strong&gt; to trigger directly or set a &lt;strong&gt;Rollout time&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-proj-set-rollout-time.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-proj-set-rollout-time.webp" alt="bb-proj-set-rollout-time" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 3: Manual rollout with custom approval (Enterprise Plan)
&lt;/h3&gt;

&lt;p&gt;If you want the approval flow to be more dynamic based on the context like the type of SQL statements, the affected rows and etc,&lt;br&gt;
then you can configure &lt;a href="https://www.bytebase.com/docs/administration/custom-approval/" rel="noopener noreferrer"&gt;custom approval flow&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Go to &lt;strong&gt;Instances&lt;/strong&gt; and click &lt;strong&gt;Assign License&lt;/strong&gt; for both instances. Without doing this, the enterprise plan required for custom approval won't be enabled on instances.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Settings&lt;/strong&gt; (the gear icon) &amp;gt; &lt;strong&gt;Security &amp;amp; Policy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Custom Approval&lt;/strong&gt;. Choose &lt;code&gt;Project Owner -&amp;gt; DBA&lt;/code&gt; as High Risk for DDL.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-custom-approval.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-custom-approval.webp" alt="bb-custom-approval" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;the related risk rules&lt;/strong&gt; or &lt;strong&gt;Settings&lt;/strong&gt; (the gear icon) &amp;gt; &lt;strong&gt;Security &amp;amp; Policy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Risk Center&lt;/strong&gt;. Click &lt;strong&gt;Add rule&lt;/strong&gt;. Set &lt;code&gt;High&lt;/code&gt; Risk and &lt;code&gt;DDL&lt;/code&gt; as &lt;code&gt;The risk for the production environment is considered to be high.&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-risk-center-add-rule.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-risk-center-add-rule.webp" alt="bb-risk-center-add-rule" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Settings&lt;/strong&gt; (the gear icon) and add a DBA account. Click it in the &lt;strong&gt;Active members&lt;/strong&gt; list, and edit its password. You'll need this account later to do the approval.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;strong&gt;Environments&lt;/strong&gt; &amp;gt; &lt;strong&gt;Prod&lt;/strong&gt;, you now unlock the third option for rollout policy &lt;code&gt;Manual rollout by the last approver from the custom approval flow&lt;/code&gt;. Choose it.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-env-prod-manual-approval.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-env-prod-manual-approval.webp" alt="bb-env-prod-manual-approval" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;code&gt;Sample Project&lt;/code&gt;, click &lt;strong&gt;Edit Schema&lt;/strong&gt;, choose both &lt;code&gt;Test&lt;/code&gt; and &lt;code&gt;Prod&lt;/code&gt; databases, and click &lt;strong&gt;Next&lt;/strong&gt;. Paste the following SQL statements into &lt;strong&gt;Raw SQL&lt;/strong&gt;, and click &lt;strong&gt;Preview issue&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="nv"&gt;"public"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;"employee"&lt;/span&gt;
    &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;COLUMN&lt;/span&gt; &lt;span class="nv"&gt;"district"&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create the issue and the approval flow is matched. Since it's in the pipeline, it will be brought forward to the &lt;code&gt;Test&lt;/code&gt; stage to review earlier. Follow its order to approve. &lt;code&gt;DBA&lt;/code&gt; will be the one to do the rollout.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-custom-approval-waiting.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fdeploy-schema-migration%2Fbb-issue-custom-approval-waiting.webp" alt="bb-issue-custom-approval-waiting" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;You have now learned how to use Bytebase to deploy schema migration in a basic way. Bytebase also provides other advanced features for your interests:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.bytebase.com/docs/vcs-integration/overview/" rel="noopener noreferrer"&gt;GitOps&lt;/a&gt; - Observe Git code push events and trigger schema migration;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.bytebase.com/docs/change-database/batch-change/" rel="noopener noreferrer"&gt;Batch changes&lt;/a&gt; - Change multiple databases in a single workflow;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.bytebase.com/docs/branching/" rel="noopener noreferrer"&gt;Branching&lt;/a&gt; - Collaborate on schema changes using Git-like branching;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.bytebase.com/docs/changelist/" rel="noopener noreferrer"&gt;Changelist&lt;/a&gt; - Organize and apply changes sequentially, or export them for offline execution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Join our &lt;a href="https://discord.com/invite/huyw7gRsyA" rel="noopener noreferrer"&gt;Discord channel&lt;/a&gt; to discuss.&lt;/p&gt;

</description>
      <category>database</category>
      <category>devops</category>
      <category>sql</category>
      <category>schema</category>
    </item>
    <item>
      <title>🐣 Step-by-Step Guide to Data Masking 🎭</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Fri, 13 Oct 2023 09:50:51 +0000</pubDate>
      <link>https://forem.com/bytebase/step-by-step-guide-to-data-masking-1h4l</link>
      <guid>https://forem.com/bytebase/step-by-step-guide-to-data-masking-1h4l</guid>
      <description>&lt;p&gt;Bytebase &lt;strong&gt;Dynamic Data Masking&lt;/strong&gt; can mask sensitive data in the query result based on the context on the fly.&lt;br&gt;
It helps organizations to &lt;strong&gt;protect sensitive data&lt;/strong&gt; from being exposed to unauthorized users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Fsecurity%2Fdata-masking%2Fbb-masking-overview.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Fsecurity%2Fdata-masking%2Fbb-masking-overview.webp" alt="bb-masking-overview" width="800" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This tutorial will teach you how to set up and try out data masking in Bytebase within 30 mins.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before starting, make sure you have installed &lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Preparation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Make sure your Docker is running, and start the Bytebase Docker container with following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--restart&lt;/span&gt; always &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--publish&lt;/span&gt; 5678:8080 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-cmd&lt;/span&gt; &lt;span class="s2"&gt;"curl --fail http://localhost:5678/healthz || exit 1"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-interval&lt;/span&gt; 5m &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-timeout&lt;/span&gt; 60s &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--volume&lt;/span&gt; ~/.bytebase/data:/var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  bytebase/bytebase:%%bb_version%% &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--data&lt;/span&gt; /var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--port&lt;/span&gt; 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Bytebase is running successfully in Docker, and you can visit it via &lt;code&gt;localhost:5678&lt;/code&gt;. Register an admin account and it will be granted the &lt;code&gt;workspace owner&lt;/code&gt; role automatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go back to the Bytebase console, click &lt;strong&gt;Start free trial&lt;/strong&gt; on the left bottom and upgrade to &lt;strong&gt;Enterprise plan&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Instances&lt;/strong&gt;, and click &lt;strong&gt;Assign License&lt;/strong&gt;. Select both instances, and click &lt;strong&gt;Confirm&lt;/strong&gt;. Without doing this, the enterprise plan required for data masking won't be enabled on instances.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  No Masking
&lt;/h3&gt;

&lt;p&gt;Login to Bytebase,click &lt;strong&gt;SQL Editor&lt;/strong&gt;, you'll be redirected to SQL Editor page. Choose &lt;code&gt;(Prod) employee&lt;/code&gt; &amp;gt; &lt;code&gt;public&lt;/code&gt; &amp;gt; &lt;code&gt;employee&lt;/code&gt;, and then run &lt;code&gt;SELECT * FROM employee;&lt;/code&gt;, you'll see the following result. Run the same query against &lt;code&gt;(Test) employee&lt;/code&gt;, the result is the same.&lt;br&gt;
   &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-employee-prod.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-employee-prod.webp" alt="bb-sql-editor-query-employee-prod" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-employee-test.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-employee-test.webp" alt="bb-sql-editor-query-employee-test" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Global Masking Rule
&lt;/h3&gt;

&lt;p&gt;You may want to batch apply masking settings, for example, you want to mask all the &lt;code&gt;birth_date&lt;/code&gt; columns in all the tables in the &lt;code&gt;employee&lt;/code&gt; database. You can use &lt;strong&gt;Global Masking Rule&lt;/strong&gt; to achieve this.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click the &lt;strong&gt;Setting icon&lt;/strong&gt; on the top right. Click &lt;strong&gt;Security &amp;amp; Policy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Data Masking&lt;/strong&gt;. Click &lt;strong&gt;Global Masking Rule&lt;/strong&gt; and then &lt;strong&gt;Add rule&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Name the rule as &lt;code&gt;birth_date should be masked&lt;/code&gt;, and select &lt;code&gt;Column name&lt;/code&gt;, &lt;code&gt;==&lt;/code&gt;. Fill &lt;code&gt;birth_date&lt;/code&gt; in the input box, and click &lt;strong&gt;Confirm&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-data-masking-global-birth-date.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-data-masking-global-birth-date.webp" alt="bb-data-masking-global-birth-date" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go back to the SQL Editor page, Choose &lt;code&gt;(Prod) employee&lt;/code&gt; &amp;gt; &lt;code&gt;public&lt;/code&gt; &amp;gt; &lt;code&gt;employee&lt;/code&gt; and run &lt;code&gt;SELECT * FROM employee;&lt;/code&gt; again. You'll see the &lt;code&gt;birth_date&lt;/code&gt; is masked. Choose &lt;code&gt;(Test) employee&lt;/code&gt;, the result is the same.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-employee-prod-masked.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-employee-prod-masked.webp" alt="bb-sql-editor-query-employee-prod-masked" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-employee-test-masked.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-employee-test-masked.webp" alt="bb-sql-editor-query-employee-test-masked" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Column Masking Rule
&lt;/h3&gt;

&lt;p&gt;If you want to mask a specific column in a specific table, you can use &lt;strong&gt;Column Masking Rule&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Databases&lt;/strong&gt; and choose &lt;code&gt;employee&lt;/code&gt; on &lt;code&gt;Prod&lt;/code&gt;, and select &lt;code&gt;salary&lt;/code&gt; table.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the edit(pen) icon on the &lt;code&gt;amount&lt;/code&gt; row, and click &lt;strong&gt;Full&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-database-table-amount.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-database-table-amount.webp" alt="bb-database-table-amount" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go back to the SQL Editor page, Choose &lt;code&gt;(Prod) employee&lt;/code&gt; &amp;gt; &lt;code&gt;public&lt;/code&gt; &amp;gt; &lt;code&gt;salary&lt;/code&gt; and run &lt;code&gt;SELECT * FROM salary;&lt;/code&gt; again. You'll see the &lt;code&gt;amount&lt;/code&gt; is masked. Choose &lt;code&gt;(Test) employee&lt;/code&gt;, it's not.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-salary-prod-masked.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-salary-prod-masked.webp" alt="bb-sql-editor-query-salary-prod-masked" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-salary-test.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-salary-test.webp" alt="bb-sql-editor-query-salary-test" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Grant unmasked access to a user
&lt;/h3&gt;

&lt;p&gt;What if you want to reveal the masked data to a specific user? You can grant unmasked access.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Settings icon&lt;/strong&gt; on the top right, and click &lt;strong&gt;Members&lt;/strong&gt;. Add a &lt;code&gt;DBA&lt;/code&gt; user and click &lt;strong&gt;+ Add&lt;/strong&gt;. Click its link in the &lt;strong&gt;Active members&lt;/strong&gt; section, click &lt;strong&gt;Edit&lt;/strong&gt; to set a password, click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Databases&lt;/strong&gt; and choose &lt;code&gt;employee&lt;/code&gt; on &lt;code&gt;Prod&lt;/code&gt;, and select &lt;code&gt;salary&lt;/code&gt; table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the &lt;strong&gt;edit(pen) icon&lt;/strong&gt; on the &lt;code&gt;amount&lt;/code&gt; row, and click &lt;strong&gt;Grant Access&lt;/strong&gt;. Select the &lt;code&gt;DBA&lt;/code&gt; user, and click &lt;strong&gt;Confirm&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-database-table-amount-grant-access.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-database-table-amount-grant-access.webp" alt="bb-database-table-amount-grant-access" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Login as the &lt;code&gt;DBA&lt;/code&gt; user, go to SQL Editor, choose &lt;code&gt;(Prod)Employee&lt;/code&gt; &amp;gt; &lt;code&gt;public&lt;/code&gt; &amp;gt; &lt;code&gt;salary&lt;/code&gt; and run &lt;code&gt;SELECT * FROM salary;&lt;/code&gt; again. You'll see the &lt;code&gt;amount&lt;/code&gt; is not masked.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-salary-prod-not-masked.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fstep-by-step-guide-to-data-masking%2Fbb-sql-editor-query-salary-prod-not-masked.webp" alt="bb-sql-editor-query-salary-prod-not-masked" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;You can now mask data in Bytebase using two methods: use &lt;strong&gt;Global Masking Rule&lt;/strong&gt; to batch apply masking settings, and use &lt;strong&gt;Column Masking Rule&lt;/strong&gt; to mask a specific column in a specific table. You can also grant access to a specific user to reveal the masked data.&lt;/p&gt;

&lt;p&gt;Bytebase supports &lt;a href="https://www.bytebase.com/docs/introduction/supported-databases/" rel="noopener noreferrer"&gt;Data Masking for different databases&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you have any questions, please &lt;a href="https://discord.com/invite/huyw7gRsyA" rel="noopener noreferrer"&gt;join our discord&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>security</category>
      <category>database</category>
      <category>mysql</category>
      <category>postgres</category>
    </item>
    <item>
      <title>How to Manage Data Access for Developers</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Tue, 05 Sep 2023 03:15:22 +0000</pubDate>
      <link>https://forem.com/bytebase/how-to-manage-data-access-for-developers-30of</link>
      <guid>https://forem.com/bytebase/how-to-manage-data-access-for-developers-30of</guid>
      <description>&lt;p&gt;When you have a team of developers, it is critical to restrict their access to data to only what they need to do their job. This ensures to protect sensitive data and prevent unauthorized access.&lt;/p&gt;

&lt;p&gt;Bytebase provides several powerful features to help you achieve this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can restrict users to only view data in a specific environment.&lt;/li&gt;
&lt;li&gt;Developer can require approval to access a specific table.&lt;/li&gt;
&lt;li&gt;You can mask sensitive data, such as salary.&lt;/li&gt;
&lt;li&gt;You can track who has accessed which data.&lt;/li&gt;
&lt;li&gt;You can add watermarks to your data to deter unauthorized copying.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This tutorial will walk you through how to use these features in Bytebase.&lt;/p&gt;

&lt;p&gt;All are &lt;strong&gt;Enterprise Plan&lt;/strong&gt; only features. However, you can start a &lt;strong&gt;14-day trial of the Enterprise Plan&lt;/strong&gt; with one click without providing additional information (no credit card required).&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparation
&lt;/h2&gt;

&lt;p&gt;Make sure you have &lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; installed, and if you don’t have important existing Bytebase data locally, you can start over from scratch by &lt;code&gt;rm -rf ~/.bytebase/data&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You’ll need two Bytebase accounts –  one &lt;strong&gt;Owner&lt;/strong&gt; and one &lt;strong&gt;Developer&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Owner&lt;/strong&gt; is the one who configures the settings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developer&lt;/strong&gt; is the one who should only see information based on the configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 1 - Run Bytebase via Docker
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Make sure your docker daemon is running, and then start the Bytebase docker container by typing the following command in the terminal.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--name&lt;/span&gt; bytebase &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--restart&lt;/span&gt; always &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--publish&lt;/span&gt; 5678:8080 &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--volume&lt;/span&gt; ~/.bytebase/data:/var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
bytebase/bytebase:2.7.0 &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--data&lt;/span&gt; /var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--port&lt;/span&gt; 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2 - Register accounts Owner and Developer
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Visit &lt;code&gt;localhost:5678&lt;/code&gt; in the browser. Register an admin account, we’ll refer to it as &lt;strong&gt;Owner&lt;/strong&gt;. This account will be granted &lt;code&gt;Workspace Owner&lt;/code&gt; role. To keep it simple, we use this &lt;strong&gt;Owner&lt;/strong&gt; instead of registerating another &lt;strong&gt;DBA&lt;/strong&gt; in this tutorial. Check &lt;a href="https://www.bytebase.com/docs/concepts/roles-and-permissions" rel="noopener noreferrer"&gt;Roles and Permissions (RBAC)&lt;/a&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-admin-register.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-admin-register.webp" alt="admin-register" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log out and register another normal account  - we’ll refer to it as &lt;strong&gt;Developer&lt;/strong&gt;. This account will be granted &lt;code&gt;Workspace Developer&lt;/code&gt; role.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-normal-register.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-normal-register.webp" alt="register" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switch back to &lt;strong&gt;Owner&lt;/strong&gt;, now you can see there's a &lt;code&gt;Sample Project&lt;/code&gt; with two embedded databases both named &lt;code&gt;employee&lt;/code&gt; mapping to &lt;code&gt;Test&lt;/code&gt; and &lt;code&gt;Prod&lt;/code&gt; environments respectively.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-proj-db.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-proj-db.webp" alt="bb-proj-db" width="800" height="526"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Members&lt;/strong&gt; and &lt;strong&gt;Grant Access&lt;/strong&gt; to add &lt;strong&gt;Developer&lt;/strong&gt; as &lt;code&gt;Developer&lt;/code&gt;. Only after this, can he see the project.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-proj-members-dev.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-proj-members-dev.webp" alt="bb-proj-members-dev" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 3 - Start Enterprise Plan trial and assign license to instances
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Start free trial&lt;/strong&gt; on the left bottom. Click &lt;strong&gt;Start 14 days trial (no credit card required)&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Instances&lt;/strong&gt; on the top navigation bar. You can see there are two instances. Click them one by one, and turn on &lt;strong&gt;Assign License&lt;/strong&gt; for both. You may check &lt;a href="https://www.bytebase.com/docs/administration/license/" rel="noopener noreferrer"&gt;Manage License&lt;/a&gt; for more details.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-instance-assign-license.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-instance-assign-license.webp" alt="bb-instance-assign-license" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Data Access Control - Query Data
&lt;/h2&gt;

&lt;p&gt;Log in as &lt;strong&gt;Developer&lt;/strong&gt;, and you can see &lt;code&gt;Sample Project&lt;/code&gt;. Click &lt;strong&gt;SQL Editor&lt;/strong&gt; on the left bar. Within SQL Editor, you can't see anything. It's because you don't have any database access permission yet.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-sql-editor-blank.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-sql-editor-blank.webp" alt="bb-sql-editor-blank" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1 - Developer can skip approvals to query data
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Log in as &lt;strong&gt;Owner&lt;/strong&gt;, and go to &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Data Access Control&lt;/strong&gt;. Check &lt;code&gt;Skip approval&lt;/code&gt; for &lt;strong&gt;Query Data&lt;/strong&gt; in &lt;code&gt;Test&lt;/code&gt; environment.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-owner-dac-skip.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-owner-dac-skip.webp" alt="bb-owner-dac-skip" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in as &lt;strong&gt;Developer&lt;/strong&gt; and go into SQL Editor again. Now you can see database under &lt;code&gt;Test&lt;/code&gt; environment. Select &lt;code&gt;(Prod)employee&lt;/code&gt;, input &lt;code&gt;SELECT * FROM salary;&lt;/code&gt; and run and you can see the result. Change &lt;code&gt;salary&lt;/code&gt; to any other tables and run, you can see data as well.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-dev-sql-editor-test-select-salary.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-dev-sql-editor-test-select-salary.webp" alt="bb-dev-sql-editor-test-select-salary" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 2 - Developer can request to query data
&lt;/h3&gt;

&lt;p&gt;In practice, developers can access any database on &lt;code&gt;Test&lt;/code&gt; environment, but they need to obtain permission to access &lt;code&gt;Prod&lt;/code&gt; environment. In this step, we'll show you how to implement this.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Log in as &lt;strong&gt;Owner&lt;/strong&gt;, and go to &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Custom Approval&lt;/strong&gt;. Scroll down to &lt;strong&gt;Request Query&lt;/strong&gt;, and choose &lt;code&gt;Workspace Owner&lt;/code&gt; as &lt;strong&gt;Approval flow&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Risk Center&lt;/strong&gt;. Click &lt;strong&gt;Add Rule&lt;/strong&gt;. Choose &lt;code&gt;Request Query&lt;/code&gt; as &lt;strong&gt;Type&lt;/strong&gt;. Choose &lt;code&gt;High&lt;/code&gt; as &lt;strong&gt;Risk&lt;/strong&gt;. Click &lt;strong&gt;Load&lt;/strong&gt; for the first template on the right. Click &lt;strong&gt;Add&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-owner-risk-center-request-query.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-owner-risk-center-request-query.webp" alt="bb-owner-risk-center-request-query" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in as &lt;strong&gt;Developer&lt;/strong&gt;, and go to &lt;code&gt;Sample Project&lt;/code&gt;, click &lt;strong&gt;Request Query&lt;/strong&gt;. Choose &lt;strong&gt;Manual select&lt;/strong&gt; and then &lt;code&gt;employee&lt;/code&gt; table under &lt;code&gt;Prod&lt;/code&gt; environment. Click &lt;strong&gt;OK&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-proj-request-query-salary.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-proj-request-query-salary.webp" alt="bb-proj-request-query-salary" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A request issue is created with the approval flow &lt;code&gt;Workspace Owner&lt;/code&gt; we just defined.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-issue-request.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-issue-request.webp" alt="bb-issue-request" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in as &lt;strong&gt;Owner&lt;/strong&gt;, go to this issue and click &lt;strong&gt;Approve&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in as &lt;strong&gt;Developer&lt;/strong&gt;, and go to SQL Editor. You can see &lt;code&gt;salary&lt;/code&gt; table under &lt;code&gt;Prod&lt;/code&gt; environment. Select &lt;code&gt;(Prod)employee&lt;/code&gt;, input &lt;code&gt;SELECT * FROM salary;&lt;/code&gt; and run, you'll see the result.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-salary-before-masking.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-salary-before-masking.webp" alt="bb-salary-before-masking" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Input &lt;code&gt;SELECT * FROM employee;&lt;/code&gt; and run, it'll show permission denied. You can click &lt;strong&gt;Request Query&lt;/strong&gt; to request permission.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 3 - Owner can grant access to query data directly
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Log in as &lt;strong&gt;Owner&lt;/strong&gt;, and go to &lt;code&gt;Sample Project&lt;/code&gt;. Click &lt;strong&gt;Members&lt;/strong&gt; and then &lt;strong&gt;Grant Access&lt;/strong&gt;. Choose &lt;code&gt;Developer&lt;/code&gt; and assign the role &lt;code&gt;Querier&lt;/code&gt;, &lt;code&gt;All&lt;/code&gt; for &lt;strong&gt;Databases&lt;/strong&gt;. Click &lt;strong&gt;Confirm&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Log in as &lt;strong&gt;Developer&lt;/strong&gt;, and go to SQL Editor. You can see all databases under &lt;code&gt;Test&lt;/code&gt; and &lt;code&gt;Prod&lt;/code&gt; environment. Select &lt;code&gt;(Prod)employee&lt;/code&gt;, input &lt;code&gt;SELECT * FROM employee;&lt;/code&gt; and run, you can see the result. Change &lt;code&gt;employee&lt;/code&gt; to any other tables and run, you can see data as well.
## Data Access Control - Export Data
Export Data is similar to Query Data. &lt;strong&gt;Developer&lt;/strong&gt; can skip approvals, request approvals to export data or be granted &lt;code&gt;Exporter&lt;/code&gt; role directly by &lt;strong&gt;Owner&lt;/strong&gt;.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-export-request.webp" alt="bb-export-request" width="800" height="415"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Data Masking
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Log in as &lt;strong&gt;Developer&lt;/strong&gt;, and go to SQL Editor. Select &lt;code&gt;(Prod)employee&lt;/code&gt;, input &lt;code&gt;SELECT * FROM salary;&lt;/code&gt; and run, you can see all the information. We want to mask the &lt;code&gt;amount&lt;/code&gt; column.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Login in as &lt;strong&gt;Owner&lt;/strong&gt;, click &lt;strong&gt;Databases&lt;/strong&gt; on the top navigation bar and then choose &lt;code&gt;employee&lt;/code&gt; under &lt;code&gt;Prod&lt;/code&gt; environment. Scroll down to &lt;strong&gt;Tables&lt;/strong&gt;, click &lt;code&gt;salary&lt;/code&gt; table, and check &lt;code&gt;amount&lt;/code&gt; row as &lt;strong&gt;Sensitive&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-owner-masking-salary.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-owner-masking-salary.webp" alt="bb-owner-masking-salary" width="800" height="562"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in as &lt;strong&gt;Developer&lt;/strong&gt;, and go to SQL Editor. Select &lt;code&gt;(Prod)employee&lt;/code&gt;, input &lt;code&gt;SELECT * FROM salary;&lt;/code&gt; and run, you can see the &lt;code&gt;amount&lt;/code&gt; column is masked.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-masking-salary.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-masking-salary.webp" alt="bb-masking-salary" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Audit Log
&lt;/h2&gt;

&lt;p&gt;Bytebase records everything happened within the system. You may check the audit log.&lt;br&gt;
Log in as &lt;strong&gt;Owner&lt;/strong&gt;, and go to &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Audit Log&lt;/strong&gt;. You can see all the queries you've run.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-owner-audit-log.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-owner-audit-log.webp" alt="bb-owner-audit-log" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Watermark
&lt;/h2&gt;

&lt;p&gt;Bytebase provides watermark feature to help you identify the data source. You can click &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;General&lt;/strong&gt;, and scroll to &lt;strong&gt;Security&lt;/strong&gt; to enable it.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-watermark.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.bytebase.com%2Fcontent%2Fdocs%2Ftutorials%2Fhow-to-manage-data-access-for-developers%2Fbb-watermark.webp" alt="bb-watermark" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;With Bytebase, you have now tried out the basic management of data access for developers. If you want to know more about database change as well, you can check &lt;a href="https://www.bytebase.com/docs/tutorials/database-change-management-with-postgresql/" rel="noopener noreferrer"&gt;DevOps: Database Change Management with PostgreSQL&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>developer</category>
      <category>database</category>
      <category>data</category>
      <category>security</category>
    </item>
    <item>
      <title>DevOps: Database Change Management with MariaDB and GitHub</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Sat, 17 Jun 2023 16:46:33 +0000</pubDate>
      <link>https://forem.com/adela_bytebase/devops-database-change-management-with-mariadb-and-github-76f</link>
      <guid>https://forem.com/adela_bytebase/devops-database-change-management-with-mariadb-and-github-76f</guid>
      <description>&lt;p&gt;This is a series of articles about DevOps: Database Change Management with MariaDB&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/adela_bytebase/devops-database-change-management-with-mariadb-17pa"&gt;DevOps: Database Change Management with MariaDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DevOps: Database Change Management with MariaDB and GitHub (this one)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;In the last article &lt;a href="https://dev.to/adela_bytebase/devops-database-change-management-with-mariadb-17pa"&gt;DevOps: Database Change Management with MariaDB&lt;/a&gt;, you have tried UI workflow in Bytebase.&lt;/p&gt;

&lt;p&gt;This tutorial will bring you to the next level by introducing the GitOps workflow, where you commit the schema change script to the GitHub repository, which will in turn trigger the schema deployment pipeline in Bytebase.&lt;/p&gt;

&lt;p&gt;You can use Bytebase free version to finish the tutorial.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features included
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitOps Workflow&lt;/li&gt;
&lt;li&gt;Change History&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you start this tutorial, make sure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have followed our previous UI-based change tutorial &lt;a href="https://dev.to/adela_bytebase/devops-database-change-management-with-mariadb-17pa"&gt;DevOps: Database Change Management with MariaDB&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You have a GitHub account.&lt;/li&gt;
&lt;li&gt;You have a public GitHub repository, e.g  &lt;code&gt;test-bb-mariadb-gitops&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You have &lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt; installed locally.&lt;/li&gt;
&lt;li&gt;You have a &lt;a href="http://ngrok.com"&gt;ngrok&lt;/a&gt; account. ngrok is a reverse proxy tunnel, and in our case, we need it for a public network address in order to receive webhooks from &lt;a href="http://GitHub.com"&gt;GitHub.com&lt;/a&gt;. We use ngrok here for demonstration purposes. For production use, we recommend using &lt;a href="https://caddyserver.com/"&gt;Caddy&lt;/a&gt;.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0gXGx0u_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/ngrok.webp" alt="ngrok" width="629" height="258"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1 - Run Bytebase in Docker with URL generated by ngrok
&lt;/h2&gt;

&lt;p&gt;To make local-running Bytebase visible to GitHub, we’ll pass ngrok generated URL to &lt;a href="https://www.bytebase.com/docs/get-started/install/external-url"&gt;--external-url&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Login to &lt;a href="https://dashboard.ngrok.com/"&gt;ngrok Dashboard&lt;/a&gt; and follow its &lt;a href="https://dashboard.ngrok.com/get-started/setup"&gt;Getting Started&lt;/a&gt; steps to install and configure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   ngrok http 5678
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and obtain the public URL:&lt;br&gt;
   &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yozONO-d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/terminal-ngrok.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yozONO-d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/terminal-ngrok.webp" alt="terminal-ngrok" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make sure your Docker daemon is running, if it’s running Bytebase container for &lt;a href="https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb"&gt;the previous tutorial&lt;/a&gt;, there're two ways:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;1a. Go to &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Workspace&lt;/strong&gt; &amp;gt; &lt;strong&gt;General&lt;/strong&gt;, fill in the &lt;strong&gt;External URL&lt;/strong&gt; field and click &lt;strong&gt;Update&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;1b. Stop and remove it. The data created in the last tutorial is stored under &lt;code&gt;~/.bytebase/data&lt;/code&gt; by default and will be restored if the system restarts. Start the Bytebase Docker container by typing the following command in the terminal. Pay attention to the last parameter &lt;code&gt;--external-url https://1681-149-129-123-75.ngrok-free.app&lt;/code&gt;, which is generated by ngrok.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker run &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--name&lt;/span&gt; bytebase &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--platform&lt;/span&gt; linux/amd64 &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--restart&lt;/span&gt; always &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--publish&lt;/span&gt; 5678:8080 &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--health-cmd&lt;/span&gt; &lt;span class="s2"&gt;"curl --fail http://localhost:5678/healthz || exit 1"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--health-interval&lt;/span&gt; 5m &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--health-timeout&lt;/span&gt; 60s &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--volume&lt;/span&gt; ~/.bytebase/data:/var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
   bytebase/bytebase:%%bb_version%% &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--data&lt;/span&gt; /var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--port&lt;/span&gt; 8080 &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--external-url&lt;/span&gt; https://1681-149-129-123-75.ngrok-free.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You can now visit Bytebase via &lt;code&gt;https://70ca-154-9-204-36.ngrok.io/&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 2 - Find your MariaDB instance in Bytebase
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Visit &lt;code&gt;https://70ca-154-9-204-36.ngrok.io/&lt;/code&gt;in your browser, and log in using your admin account created from the previous article.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Projects&lt;/strong&gt; on the top bar, and then click &lt;strong&gt;Create Project&lt;/strong&gt;. Fill in &lt;code&gt;Demo Git&lt;/code&gt; as &lt;strong&gt;Project Name&lt;/strong&gt;, &lt;code&gt;DGT&lt;/code&gt; as &lt;strong&gt;Key&lt;/strong&gt;, &lt;code&gt;Standard&lt;/code&gt; as &lt;strong&gt;Mode&lt;/strong&gt; and click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to the &lt;code&gt;Demo Git&lt;/code&gt; project, and click &lt;strong&gt;New DB&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill the form with the following information and click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: &lt;code&gt;demo_db_git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment&lt;/strong&gt;: &lt;code&gt;Test&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance&lt;/strong&gt;: &lt;code&gt;MariaDB test&lt;/code&gt;
It will create an issue "CREATE DATABASE …" automatically. Because it’s for &lt;code&gt;Test&lt;/code&gt; environment, the issue will automatically run then becomes &lt;code&gt;Done&lt;/code&gt;. The database is created.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;New DB&lt;/strong&gt; again, fill the form with the following information and click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: &lt;code&gt;demo_db_git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment&lt;/strong&gt;: &lt;code&gt;Prod&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance&lt;/strong&gt;: &lt;code&gt;MariaDB prod&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It will create an issue "CREATE DATABASE …" automatically. Because it’s for &lt;code&gt;Prod&lt;/code&gt; environment, the issue will require manual rollout. Click &lt;strong&gt;Rollout&lt;/strong&gt; to run then becomes &lt;code&gt;Done&lt;/code&gt;. The database is created.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 3 - Connect Bytebase with GitHub.com
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Settings&lt;/strong&gt; on the top bar, and then click &lt;strong&gt;Workspace&lt;/strong&gt; &amp;gt; &lt;strong&gt;Version Control&lt;/strong&gt;. Choose &lt;strong&gt;GitHub.com&lt;/strong&gt; and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6e4F-tAh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-settings-vc-step1.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6e4F-tAh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-settings-vc-step1.webp" alt="bb-settings-vc-step1" width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the instructions within &lt;strong&gt;STEP 2&lt;/strong&gt;, and in this tutorial, we will use a personal account instead of an organization account. The configuration is similar.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Xf2ooEMR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-settings-vc-step2.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xf2ooEMR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-settings-vc-step2.webp" alt="bb-settings-vc-step2" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to your GitHub account. Click &lt;strong&gt;Settings&lt;/strong&gt; on the dropdown menu.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ArVxXXR---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/gh-settings-dropdown.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ArVxXXR---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/gh-settings-dropdown.webp" alt="gh-settings-dropdown" width="800" height="350"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Developer Settings&lt;/strong&gt; at the bottom of the left side bar. Click &lt;strong&gt;OAuth Apps&lt;/strong&gt;, and click &lt;strong&gt;New OAuth App&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V5TEGl9B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/gh-oauth-apps.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V5TEGl9B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/gh-oauth-apps.webp" alt="gh-oauth-apps" width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill &lt;strong&gt;Application name&lt;/strong&gt; and then copy the &lt;strong&gt;Homepage&lt;/strong&gt; and &lt;strong&gt;Authorization callback URL&lt;/strong&gt; in Bytebase and fill them. Click &lt;strong&gt;Register application&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the OAuth application is created successfully. Click &lt;strong&gt;Generate a new client secret&lt;/strong&gt;. Copy &lt;strong&gt;Client ID&lt;/strong&gt; and this newly generated client secret and paste them back in Bytebase.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dcYOGHpp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/gh-copy-client-id.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dcYOGHpp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/gh-copy-client-id.webp" alt="gh-copy-client-id" width="800" height="517"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w7h7LGpv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-vc-client-id.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w7h7LGpv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-vc-client-id.webp" alt="bb-vc-client-id" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Next&lt;/strong&gt;. You will be redirected to the confirmation page. Click &lt;strong&gt;Confirm and add&lt;/strong&gt;, and the Git provider is successfully added.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6QWqsBaA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-settings-vc-step3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6QWqsBaA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-settings-vc-step3.webp" alt="bb-settings-vc-step3" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Step 4 - Enable GitOps workflow with MariaDB
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to project &lt;code&gt;Demo Git&lt;/code&gt;, click &lt;strong&gt;GitOps&lt;/strong&gt;, and choose &lt;strong&gt;GitOps Workflow&lt;/strong&gt;. Click &lt;strong&gt;Configure GitOps&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yEOu9xQo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-demo-git-gitops-workflow.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yEOu9xQo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-demo-git-gitops-workflow.webp" alt="bb-demo-git-gitops-workflow" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose GitHub.com - the provider you just added. It will display all the repositories you can manipulate. Choose &lt;code&gt;test-bb-mariadb-gitops&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep the default setting, and click &lt;strong&gt;Finish&lt;/strong&gt;. The GitOps workflow is successfully enabled.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y5iwm69B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-demo-git-gitops-enabled.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y5iwm69B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-demo-git-gitops-enabled.webp" alt="bb-demo-git-gitops-enabled" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Step 5 - Change schema for MariaDB by pushing SQL schema change files to GitHub
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;In your GitHub repository &lt;code&gt;test-bb-mariadb-gitops&lt;/code&gt;, create a folder &lt;code&gt;bytebase&lt;/code&gt;, then create a subfolder &lt;code&gt;prod&lt;/code&gt;, and create an sql file following the pattern &lt;code&gt;{{ENV_ID}}/{{DB_NAME}}##{{VERSION}}##{{TYPE}}##{{DESCRIPTION}}.sql&lt;/code&gt;. It is the default configuration for file path template setting under project version control.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;prod/demo_git_db##2023061614300000##ddl##create_t2.sql&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;prod&lt;/code&gt; corresponds to &lt;code&gt;{{ENV_ID}}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;demo_git_db&lt;/code&gt; corresponds to &lt;code&gt;{{DB_NAME}}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;2023061614300000&lt;/code&gt; corresponds to &lt;code&gt;{{VERSION}}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ddl&lt;/code&gt; corresponds to &lt;code&gt;{{TYPE}}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;create_t2&lt;/code&gt; corresponds to &lt;code&gt;{{DESCRIPTION}}&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Paste the sql script in it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;t2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Commit and push this file.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to Bytebase, and go into project &lt;code&gt;Demo Git&lt;/code&gt;. You’ll find there is a new &lt;code&gt;Push Event&lt;/code&gt; and a new issue created.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---_naYcvR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-push-event.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---_naYcvR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-push-event.webp" alt="bb-push-event" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the issue link, and you’ll see:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;The issue is created via &lt;code&gt;GitHub.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The issue is waiting for your rollout because it’s on &lt;code&gt;Prod&lt;/code&gt; environment where manual rollout is required by default.&lt;/li&gt;
&lt;li&gt;The SQL is exactly the one we have committed to the GitHub repository.&lt;/li&gt;
&lt;li&gt;The Creator is &lt;code&gt;Owner&lt;/code&gt;, because the GitHub user you use to commit the change has the same email address found in the Bytebase member list.
 &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3MscNsnP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb-and-github/bb-issue-gitops-to-rollout.webp" alt="bb-issue-gitops-to-rollout" width="800" height="454"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Rollout&lt;/strong&gt;, and the SQL will execute. The issue will be &lt;code&gt;Done&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;View change&lt;/strong&gt;, you could view the schema diff.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You may try with your &lt;code&gt;Test&lt;/code&gt; environment, the only difference is that you don’t need to rollout the issue manually.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you have &lt;strong&gt;Enterprise Plan&lt;/strong&gt;. Go to GitHub repository, you will see besides your committed sql, there is a &lt;code&gt;.demo_git_db##LATEST.sql&lt;/code&gt; file. Because you have configured &lt;code&gt;Schema path template&lt;/code&gt; before, Bytebase will write back the latest schema to that specified path after completing the schema change. Thus you have access to an update-to-date full schema at any time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary and Next
&lt;/h2&gt;

&lt;p&gt;Now you have tried out GitOps workflow, which will store your MariaDB schema in GitHub and trigger the change upon committing the change to the repository, to bring your MariaDB change workflow to the next level of Database DevOps - &lt;a href="https://www.bytebase.com/blog/database-as-code"&gt;Database as Code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In real world scenario, you might have separate features and main branches corresponding to your dev and production environment, you can check out &lt;a href="https://www.bytebase.com/docs/how-to/workflow/gitops-feature-branch"&gt;GitOps with Feature Branch Workflow&lt;/a&gt; to learn the setup. Have a try and look forward to your feedback!&lt;/p&gt;

</description>
      <category>mariadb</category>
      <category>devops</category>
      <category>github</category>
      <category>cicd</category>
    </item>
    <item>
      <title>DevOps: Database Change Management with MariaDB</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Sat, 17 Jun 2023 16:43:14 +0000</pubDate>
      <link>https://forem.com/adela_bytebase/devops-database-change-management-with-mariadb-17pa</link>
      <guid>https://forem.com/adela_bytebase/devops-database-change-management-with-mariadb-17pa</guid>
      <description>&lt;p&gt;This is a series of articles about : Database Change Management with .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database Change Management with MariaDB (this one)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/adela_bytebase/devops-database-change-management-with-mariadb-and-github-76f"&gt;Database Change Management with MariaDB and GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://mariadb.org/"&gt;&lt;/a&gt; is a community-developed, commercially supported fork of the   management system (), intended to remain  under the  .&lt;/p&gt;

&lt;p&gt;This tutorial is a step-by-step guide to setting up &lt;strong&gt;Database Change Management&lt;/strong&gt; for  in . With , a team can have a formalized review and rollout process to make   change and data change.&lt;/p&gt;

&lt;p&gt;provides a GUI for teams to perform &lt;strong&gt;Database Changes&lt;/strong&gt; and retain full &lt;strong&gt;Change History&lt;/strong&gt;.  &lt;strong&gt;Free Plan&lt;/strong&gt; is sufficient for this tutorial.&lt;/p&gt;

&lt;p&gt;In the end, there is a bonus section about &lt;strong&gt;Schema Drift Detection&lt;/strong&gt; for those advanced users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features included
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Change Workflow&lt;/li&gt;
&lt;li&gt;Change History&lt;/li&gt;
&lt;li&gt;SQL Editor Admin Mode&lt;/li&gt;
&lt;li&gt;Drift Detection&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you start, make sure you have &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.docker.com/"&gt;&lt;/a&gt; installed. You can follow the &lt;a href="https://docs.docker.com/get-docker/"&gt;official guide&lt;/a&gt; to install it.&lt;/li&gt;
&lt;li&gt;In this tutorial, we'll use &lt;a href="https://stackbricks.app/"&gt;StackBricks&lt;/a&gt; to run . You can also use other tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1 - Deploy Bytebase via
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Make sure your   is running, and start the Bytebase  with following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    run &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--name&lt;/span&gt;  &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--platform&lt;/span&gt; /amd64 &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--restart&lt;/span&gt; always &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--publish&lt;/span&gt; 5678:8080 &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--health-cmd&lt;/span&gt; &lt;span class="s2"&gt;"curl --fail http://:5678/healthz || exit 1"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--health-interval&lt;/span&gt; 5m &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--health-timeout&lt;/span&gt; 60s &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--volume&lt;/span&gt; ~/./data:/var/opt/ &lt;span class="se"&gt;\&lt;/span&gt;
   bytebase/bytebase:%%bb_version%% &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--data&lt;/span&gt; /var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--port&lt;/span&gt; 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run StackBricks, and create two  instances: 

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;test&lt;/code&gt;,&lt;code&gt;3307&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;prod&lt;/code&gt;,&lt;code&gt;3308&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z2J64da_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/stackbricks-2-instances.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z2J64da_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/stackbricks-2-instances.webp" alt="stackbricks" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; and  are now running via .
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oEJyyyB2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/docker.webp" alt="docker" width="800" height="448"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 2 - Add  in
&lt;/h2&gt;

&lt;p&gt;In , ​​an Instance could be your on-premises  instance, an  instance and etc. In this tutorial, it's  instances.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Visit &lt;code&gt;:5678&lt;/code&gt; in your browser. Register the first  which will be granted &lt;a href="https://www.bytebase.com/docs/concepts/roles-and-permissions"&gt;&lt;code&gt;Workspace Owner&lt;/code&gt;&lt;/a&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LulGBmdb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-register-admin.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LulGBmdb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-register-admin.webp" alt="bb-register-admin.webp" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Instances&lt;/strong&gt; on the top bar and click &lt;strong&gt;Add instance&lt;/strong&gt;, choose ``. Fill the form with the following information and click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instance Name&lt;/strong&gt;: &lt;code&gt;test&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment&lt;/strong&gt;: &lt;code&gt;Test&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Host or Socket&lt;/strong&gt; and &lt;strong&gt;Port&lt;/strong&gt;: &lt;code&gt;host.docker.internal&lt;/code&gt; and &lt;code&gt;3307&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Username and password&lt;/strong&gt;: &lt;code&gt;root&lt;/code&gt; and your password&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Add instance&lt;/strong&gt; again, choose ``. Fill the form with the following information and click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instance Name&lt;/strong&gt;: &lt;code&gt;prod&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment&lt;/strong&gt;: &lt;code&gt;Prod&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Host or Socket&lt;/strong&gt; and &lt;strong&gt;Port&lt;/strong&gt;: &lt;code&gt;host.docker.internal&lt;/code&gt; and &lt;code&gt;3307&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Username and password&lt;/strong&gt;: &lt;code&gt;root&lt;/code&gt; and your password&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 3 - Create a Project
&lt;/h2&gt;

&lt;p&gt;In , &lt;strong&gt;Project&lt;/strong&gt; is the container to group logically related &lt;strong&gt;Databases&lt;/strong&gt;, &lt;strong&gt;Issues&lt;/strong&gt; and &lt;strong&gt;Users&lt;/strong&gt; together, which is similar to the project concept in other dev tools such as , . So before you deal with the database, a project must be created.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Projects&lt;/strong&gt; on the top bar.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New Project&lt;/strong&gt; to create a new one with &lt;code&gt;Demo UI&lt;/code&gt; as &lt;strong&gt;Project Name&lt;/strong&gt;, &lt;code&gt;DUI&lt;/code&gt; as &lt;strong&gt;Key&lt;/strong&gt; and &lt;code&gt;Standard&lt;/code&gt; as &lt;strong&gt;Mode&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 4 - Create a database in  via
&lt;/h2&gt;

&lt;p&gt;In , a &lt;strong&gt;Database&lt;/strong&gt; is the one created by "CREATE DATABASE xxx". A database always belongs to a single &lt;strong&gt;Project&lt;/strong&gt;. &lt;strong&gt;Issue&lt;/strong&gt; represents a specific collaboration activity between Developer and DBA such as creating a database, altering a schema. It's similar to the issue concept in other issue management tools.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to the project &lt;code&gt;Demo UI&lt;/code&gt;, and click &lt;strong&gt;New DB&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill the form with the following information and click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: &lt;code&gt;demo_db&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment&lt;/strong&gt;: &lt;code&gt;Test&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance&lt;/strong&gt;: &lt;code&gt;test&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It will create an issue "CREATE DATABASE …" automatically. Because it’s for &lt;code&gt;Test&lt;/code&gt; environment, the issue will automatically run then becomes ``. The database is created.&lt;br&gt;
   &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H-3w3ByM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-issue-demo_db_test-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H-3w3ByM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-issue-demo_db_test-done.webp" alt="bb-issue-demo_db_test-done" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;New DB&lt;/strong&gt; again, fill the form with the following information and click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: &lt;code&gt;demo_db&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment&lt;/strong&gt;: &lt;code&gt;Prod&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance&lt;/strong&gt;: &lt;code&gt;prod&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It will create an issue "CREATE DATABASE …" automatically. Because it’s for &lt;code&gt; environment, the issue will require manual rollout. Click **Rollout** to run then becomes &lt;/code&gt;. The database is created.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go back to project &lt;code&gt;Demo UI&lt;/code&gt;, click &lt;strong&gt;Databases&lt;/strong&gt; tab, and you can see there're two databases there.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 5 - Create a table in  via
&lt;/h2&gt;

&lt;p&gt;In Step 4, you actually created an issue in &lt;strong&gt;UI workflow&lt;/strong&gt; and then executed it. Let’s make it more explicit.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to project &lt;code&gt;Demo UI&lt;/code&gt;, and click &lt;strong&gt;Alter Schema&lt;/strong&gt;. Here you can choose either one or both.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jGMen-mt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-alter-schema-test-prod.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jGMen-mt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-alter-schema-test-prod.webp" alt="bb-alter-schema-test-prod" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check both &lt;code&gt;demo_db&lt;/code&gt; and click &lt;strong&gt;Next&lt;/strong&gt;. It will generate a pipeline.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Input the SQL as following, and click &lt;strong&gt;Apply to other tasks&lt;/strong&gt;. Click &lt;strong&gt;Create&lt;/strong&gt;.&lt;br&gt;
&lt;code&gt;`sql&lt;br&gt;
CREATE TABLE t1(&lt;br&gt;
  Id INT AUTO_INCREMENT,&lt;br&gt;
  (Id)&lt;br&gt;
)&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;will run SQL automatically on Test environment, but wait for manual rollout on . It's by default configuration, you can adjust it on &lt;strong&gt;Environments&lt;/strong&gt; page.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pw7wpVTe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-issue-test-done-prod.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pw7wpVTe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-issue-test-done-prod.webp" alt="bb-issue-test-done-prod" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Rollout&lt;/strong&gt; and the SQL will execute and the issue will become &lt;code&gt;Done&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the issue page, click &lt;strong&gt;View change&lt;/strong&gt;. You will see the difference.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xc2j7kX5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-issue-diff.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xc2j7kX5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-issue-diff.webp" alt="bb-issue-diff" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can also go to &lt;strong&gt;Change History&lt;/strong&gt; under the project to view the full history. Or go into a specific database to view its history.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gqRmDOFI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-demo-ui-history.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gqRmDOFI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-demo-ui-history.webp" alt="bb-demo-ui-history" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Bonus Section - Schema Drift Detection
&lt;/h2&gt;

&lt;p&gt;This section requires you to have &lt;strong&gt;Enterprise Plan&lt;/strong&gt; (you can start 14 days trial directly in the product without ). Click &lt;strong&gt;Start free trial&lt;/strong&gt; on the bottom of left sidebar.&lt;/p&gt;

&lt;p&gt;By adopting , we expect teams to use  exclusively for all schema changes. Meanwhile, if someone has made  schema change *&lt;em&gt;outside of *&lt;/em&gt;, obviously  won’t know it. And because  has recorded its own copy of schema, when  compares that with the live schema having that  schema change, it will notice a discrepancy and surface a schema drift anomaly. If that change is intended, then you should use baseline the schema state again to reconcile.&lt;/p&gt;

&lt;p&gt;In this section, you’ll be guided through this process.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You can use an external GUI or terminal to make a change to &lt;code&gt;demo-db&lt;/code&gt;. In this tutorial, we use  &lt;strong&gt;SQL Editor’s Admin mode&lt;/strong&gt; which also counts when we say &lt;strong&gt;change outside of **. Go to **SQL Editor&lt;/strong&gt;, and switch to &lt;strong&gt;Admin mode&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When you make a change in Admin mode, it will not record any history as in a normal process &lt;a href="https://www.bytebase.com/docs/sql-editor/admin-mode"&gt;/docs/sql-editor/admin-mode&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Paste the following and then press &lt;strong&gt;Enter&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;sql&lt;br&gt;
   ALTER TABLE t1&lt;br&gt;
   ADD COLUMN name (255);`&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


   ![bb-sql-editor-admin-alter-t1](https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-sql-editor-admin-alter-t1.webp)
   Admin mode skips  system and works as an external input. The change will take effect in Bytebase GUI in the next sync.

1. Wait for 10 mins. Go to **Anomaly Center**, and you can find the **Schema Drift**.
   ![bb-anomaly-center-1-drift](https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-anomaly-center-1-drift.webp)

2.  , and you’ll see the drift.
   ![bb-demo_db-drift-diff](https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-demo_db-drift-diff.webp)

3. You may also find the drift by clicking **Databases** &amp;gt; `demo_db`.

4. Go to **Databases** &amp;gt; `demo_db` &amp;gt; **Change History** and click **Establish new baseline**.
   ![bb-demo_db-establish-new-baseline](https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-demo_db-establish-new-baseline.webp)

5. It will create an issue and the issue will be `Done`.
   ![bb-issue-demo_db-baseline-done](https://www.bytebase.com/content/docs/tutorials/database-change-management-with-mariadb/bb-issue-demo_db-baseline-done.webp)

6. Go back to **Databases** &amp;gt; `demo_db` or **Anomaly Center**, and you will find the drift is gone.

## Summary and Next

Now you have connected  with Bytebase, and tried out the UI workflow to do schema change. Bytebase will record the full change history for you. With **Enterprise Plan**, you can even have schema drift detection.

In the next article, you’ll try out GitOps workflow, which will store your  schema in  and trigger the change upon committing the change to the repository, to bring your  change workflow to the next level of Database  - [Database as Code](https://www.bytebase.com/blog/database-as-code).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>mariadb</category>
      <category>devops</category>
      <category>cicd</category>
      <category>sql</category>
    </item>
    <item>
      <title>Database Change Management with Amazon Aurora and GitHub</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Mon, 13 Mar 2023 15:37:06 +0000</pubDate>
      <link>https://forem.com/adela_bytebase/database-change-management-with-amazon-aurora-and-github-56km</link>
      <guid>https://forem.com/adela_bytebase/database-change-management-with-amazon-aurora-and-github-56km</guid>
      <description>&lt;p&gt;This is a series of articles about Database Change Management with Amazon Aurora&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/adela_bytebase/database-change-management-with-amazon-aurora-15d4"&gt;Database Change Management with Amazon Aurora&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Database Change Management with Amazon Aurora and GitHub (this one)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;In the last article &lt;a href="https://www.bytebase.com/blog/database-change-management-with-amazon-aurora"&gt;Database Change Management with Amazon Aurora&lt;/a&gt;, you have tried &lt;strong&gt;UI workflow&lt;/strong&gt; in Bytebase.&lt;/p&gt;

&lt;p&gt;This tutorial will bring your Amazon Aurora schema change to the next level by introducing the &lt;strong&gt;GitOps workflow&lt;/strong&gt;, where you commit the schema change script to the GitHub repository, which will in turn trigger the schema deployment pipeline in Bytebase.&lt;/p&gt;

&lt;p&gt;You can use Bytebase free version to finish the tutorial.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features included
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitOps Workflow&lt;/li&gt;
&lt;li&gt;Change History&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you start this tutorial, make sure you have the following ready:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Followed our previous UI-based change tutorial &lt;a href="https://www.bytebase.com/blog/database-change-management-with-amazon-aurora"&gt;Database Change Management with Amazon Aurora&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;An Amazon Aurora MySQL instance.&lt;/li&gt;
&lt;li&gt;A GitHub account.&lt;/li&gt;
&lt;li&gt;A public GitHub repository, e.g  &lt;code&gt;aurora-test-bb-local&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt; installed locally.&lt;/li&gt;
&lt;li&gt;An &lt;a href="http://ngrok.com/"&gt;ngrok&lt;/a&gt; account. (ngrok is a reverse proxy tunnel, and in our case, we need it for a public network address in order to receive webhooks from GitHub. We use ngrok here for demonstration purposes. For production use, we recommend using &lt;a href="https://caddyserver.com/"&gt;Caddy&lt;/a&gt;.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bhr5pvSV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/ngrok.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bhr5pvSV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/ngrok.webp" alt="ngrok" width="629" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 - Run Bytebase in Docker with URL generated by ngrok
&lt;/h2&gt;

&lt;p&gt;To make local-running Bytebase visible to GitHub, we’ll pass the URL generated by ngrok to &lt;a href="https://www.bytebase.com/docs/get-started/install/external-url"&gt;--external-url&lt;/a&gt;. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Login to &lt;a href="https://dashboard.ngrok.com/"&gt;ngrok Dashboard&lt;/a&gt; and follow its &lt;a href="https://dashboard.ngrok.com/get-started/setup"&gt;Getting Started&lt;/a&gt; steps to install and configure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ngrok http 5678
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and obtain the public URL:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aM1IBBTB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/terminal-ngrok.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aM1IBBTB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/terminal-ngrok.webp" alt="terminal-ngrok" width="880" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Make sure your Docker daemon is running, if it’s running Bytebase container for &lt;a href="https://www.bytebase.com/blog/database-change-management-with-amazon-aurora"&gt;the previous tutorial&lt;/a&gt;, stop and remove it. The data created in the last tutorial is stored under &lt;code&gt;~/.bytebase/data&lt;/code&gt; by default and will be restored if the system restarts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the Bytebase Docker container by typing the following command in the terminal. Pay attention to the last parameter &lt;code&gt;--external-url https://b725-103-197-71-76.ap.ngrok.io&lt;/code&gt;, which is generated by ngrok.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--name&lt;/span&gt; bytebase &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--platform&lt;/span&gt; linux/amd64 &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--restart&lt;/span&gt; always &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--publish&lt;/span&gt; 5678:8080 &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--health-cmd&lt;/span&gt; &lt;span class="s2"&gt;"curl --fail http://localhost:5678/healthz || exit 1"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--health-interval&lt;/span&gt; 5m &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--health-timeout&lt;/span&gt; 60s &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--volume&lt;/span&gt; ~/.bytebase/data:/var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
bytebase/bytebase:1.13.0 &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--data&lt;/span&gt; /var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--port&lt;/span&gt; 8080 &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--external-url&lt;/span&gt; https://b725-103-197-71-76.ap.ngrok.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Bytebase is running successfully in Docker, and you can visit it via &lt;code&gt;https://b725-103-197-71-76.ap.ngrok.io&lt;/code&gt;.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hC_1XaxN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/docker.webp" alt="docker" width="880" height="501"&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Step 2 - Find your Amazon Aurora in Bytebase
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Visit Bytebase Console through the browser via your ngrok URL &lt;code&gt;https://b725-103-197-71-76.ap.ngrok.io&lt;/code&gt;. Log in using your account created from the previous tutorial.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iic-o8hS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-login.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iic-o8hS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-login.webp" alt="bb-login" width="880" height="449"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you followed the previous tutorial, you should see that the project and database created are still in your workspace.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--urbd2-kg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-home.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--urbd2-kg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-home.webp" alt="bb-home" width="880" height="510"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Step 3 - Connect Bytebase with GitHub.com
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Settings&lt;/strong&gt; on the top bar, and then click &lt;strong&gt;Workspace&lt;/strong&gt; &amp;gt; &lt;strong&gt;GitOps&lt;/strong&gt;. Choose &lt;strong&gt;GitHub.com&lt;/strong&gt; and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aAD7jVgs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-settings-gitops-1-github.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aAD7jVgs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-settings-gitops-1-github.webp" alt="bb-settings-gitops-1-github" width="880" height="509"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Follow the instructions within &lt;strong&gt;STEP 2&lt;/strong&gt;, and in this tutorial, we will use a personal account instead of an organization account. The configuration is similar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to your GitHub account. Click your avatar on the top right, and then click &lt;strong&gt;Settings&lt;/strong&gt; on the dropdown menu.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pn-oCbPo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-dropdown.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pn-oCbPo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-dropdown.webp" alt="github-dropdown" width="880" height="574"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Developer Settings&lt;/strong&gt; at the bottom of the left sidebar. Click &lt;strong&gt;OAuth Apps&lt;/strong&gt;, and add a &lt;strong&gt;New OAuth App&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pfBQCZ1b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-oauth-apps.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pfBQCZ1b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-oauth-apps.webp" alt="github-oauth-apps" width="880" height="577"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill &lt;strong&gt;Application name&lt;/strong&gt; and then copy the &lt;strong&gt;Homepage&lt;/strong&gt; and &lt;strong&gt;Authorization callback URL&lt;/strong&gt; in Bytebase and fill them. Click &lt;strong&gt;Register application&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qRoNg-vA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-register-oauth.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qRoNg-vA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-register-oauth.webp" alt="github-register-oauth" width="579" height="665"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the OAuth application is created, click &lt;strong&gt;Generate a new client secret&lt;/strong&gt;. Copy the &lt;strong&gt;Client ID&lt;/strong&gt; and the newly generated &lt;strong&gt;Client Secret&lt;/strong&gt;, paste them back into Bytebase's &lt;strong&gt;Application ID&lt;/strong&gt; and &lt;strong&gt;Secret&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KBkztCjY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-clientid-secret.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KBkztCjY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-clientid-secret.webp" alt="github-clientid-secret" width="880" height="602"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CvOgwqym--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-settings-gitops-2.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CvOgwqym--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-settings-gitops-2.webp" alt="bb-settings-gitops-2" width="880" height="542"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Next&lt;/strong&gt;. You will be redirected to the confirmation page. Click &lt;strong&gt;Confirm and add&lt;/strong&gt;, and the Git provider is successfully added.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sVPBxaQM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-auth.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sVPBxaQM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-auth.webp" alt="github-auth" width="545" height="627"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PEpehA7W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-settings-gitops-3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PEpehA7W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-settings-gitops-3.webp" alt="bb-settings-gitops-3" width="880" height="543"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Step 4 - Enable GitOps Workflow with Amazon Aurora
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to your project &lt;code&gt;TestAurora&lt;/code&gt;, click &lt;strong&gt;GitOps&lt;/strong&gt;, and choose &lt;strong&gt;GitOps Workflow&lt;/strong&gt;. Click &lt;strong&gt;Configure GitOps&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;code&gt;GitHub.com&lt;/code&gt; - the provider you just added. It will display all the repositories you can manipulate. Choose &lt;code&gt;aurora-mysql-test-bb-local&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cYxAlYsC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-project-gitops-github-list.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cYxAlYsC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-project-gitops-github-list.webp" alt="bb-project-gitops-github-list" width="880" height="547"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep the default setting, and click &lt;strong&gt;Finish&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Step 5 - Change schema for Amazon Aurora by pushing SQL schema change files to GitHub
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;In your GitHub repository &lt;code&gt;aurora-mysql-test-bb-local&lt;/code&gt;, create a folder &lt;code&gt;bytebase&lt;/code&gt;, then create a subfolder &lt;code&gt;Test&lt;/code&gt;, and create a SQL file using the naming convention
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{ENV_NAME}}/{{DB_NAME}}##{{VERSION}}##{{TYPE}}##{{DESCRIPTION}}.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It is the default configuration for the file path template setting under project &lt;code&gt;TestAurora&lt;/code&gt; &amp;gt; &lt;strong&gt;GitOps&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Paste the sql script in it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;t2&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;BIGINT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="n"&gt;course&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wWNZ_Amh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/vscode.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wWNZ_Amh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/vscode.webp" alt="vscode" width="880" height="179"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Commit and push this file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to Bytebase, and go into project &lt;code&gt;TestAurora&lt;/code&gt;. You’ll find there is a new &lt;code&gt;Push Event&lt;/code&gt; and a new &lt;code&gt;issue 107&lt;/code&gt; created.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q0-4CGS3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-project-push-event.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q0-4CGS3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-project-push-event.webp" alt="bb-project-push-event" width="880" height="542"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;code&gt;issue/107&lt;/code&gt; and go the issue page. Click &lt;strong&gt;Resolve issue&lt;/strong&gt;, and the issue will be &lt;code&gt;Done&lt;/code&gt;. You’ll see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The issue is created via GitHub.com&lt;/li&gt;
&lt;li&gt;The issue is executed without approval because it’s on &lt;code&gt;Test&lt;/code&gt; environment where manual approval is skipped by default. The Assignee is &lt;code&gt;Bytebase&lt;/code&gt;, because the execution is automatic, and requires no manual approval.&lt;/li&gt;
&lt;li&gt;The SQL is exactly the one we have committed to the GitHub repository.&lt;/li&gt;
&lt;li&gt;The Creator is &lt;code&gt;A&lt;/code&gt;, because the GitHub user you use to commit the change has the same email address found in the Bytebase member list.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZVfUGaGR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-issue-github-create-t2-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZVfUGaGR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-issue-github-create-t2-done.webp" alt="bb-issue-github-create-t2-done" width="880" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;View change&lt;/strong&gt;, you can view the schema diff.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C6EEJORm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-dbdemo-diff.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C6EEJORm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/bb-dbdemo-diff.webp" alt="bb-dbdemo-diff" width="880" height="528"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to GitHub repository, and you will see besides your committed sql, there is a &lt;code&gt;.db_demo##LATEST.sql&lt;/code&gt; file. Because you have configured &lt;a href="https://www.bytebase.com/docs/vcs-integration/name-and-organize-schema-files#schema-path-template"&gt;Schema path template&lt;/a&gt; before, Bytebase will write back the latest schema to that specified path after completing the schema change. Thus you have access to an update-to-date full schema at any time.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f9PhVK6Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-LATEST.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f9PhVK6Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora-and-github/github-LATEST.webp" alt="github-LATEST" width="880" height="434"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary and What's Next
&lt;/h2&gt;

&lt;p&gt;Now that you have tried the &lt;strong&gt;GitOps workflow&lt;/strong&gt;, which stores your Amazon Aurora schema in GitHub and triggers the change upon committing change to the repository, to bring your Amazon Aurora change workflow to the next level of Database DevOps - &lt;a href="https://www.bytebase.com/blog/database-as-code"&gt;Database as Code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can check out &lt;a href="https://dev.todocs/vcs-integration/overview"&gt;GitOps docs&lt;/a&gt; to learn more configuration details.&lt;/p&gt;

&lt;p&gt;In the real world, you might have separated feature and main branches corresponding to your development and production environment, you can check out &lt;a href="https://www.bytebase.com/docs/how-to/workflow/gitops-feature-branch"&gt;GitOps with Feature Branch Workflow&lt;/a&gt; to learn the setup. Have a try and look forward to your feedback!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>aurora</category>
      <category>github</category>
      <category>devops</category>
    </item>
    <item>
      <title>Database Change Management with Amazon Aurora</title>
      <dc:creator>Adela</dc:creator>
      <pubDate>Mon, 13 Mar 2023 15:16:58 +0000</pubDate>
      <link>https://forem.com/adela_bytebase/database-change-management-with-amazon-aurora-15d4</link>
      <guid>https://forem.com/adela_bytebase/database-change-management-with-amazon-aurora-15d4</guid>
      <description>&lt;p&gt;This is a series of articles about Database Change Management with Amazon Aurora.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database Change Management with Amazon Aurora (this one)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/adela_bytebase/database-change-management-with-amazon-aurora-and-github-56km"&gt;Database Change Management with Amazon Aurora and GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://aws.amazon.com/rds/aurora/"&gt;Amazon Aurora&lt;/a&gt; is a fully managed relational database engine that's compatible with MySQL and PostgreSQL.&lt;/p&gt;

&lt;p&gt;This tutorial is a step-by-step guide to set up Database Change Management for Amazon Aurora MySQL in &lt;a href="https://bytebase.com"&gt;Bytebase&lt;/a&gt;. With Bytebase, a team can have a formalized review and rollout process to make Amazon Aurora database schema change and data change.&lt;/p&gt;

&lt;p&gt;Bytebase provides a GUI for teams to &lt;strong&gt;perform database changes&lt;/strong&gt; and &lt;strong&gt;retain full change history&lt;/strong&gt;. You can use Bytebase free version to finish the tutorial.&lt;/p&gt;

&lt;p&gt;At the end, there is a bonus section about &lt;strong&gt;Schema Drift Detection&lt;/strong&gt; for those advanced users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features included
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Change Workflow&lt;/li&gt;
&lt;li&gt;Schema Editor&lt;/li&gt;
&lt;li&gt;SQL Editor&lt;/li&gt;
&lt;li&gt;Change History&lt;/li&gt;
&lt;li&gt;DML Rollback&lt;/li&gt;
&lt;li&gt;Drift Detection&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you start, make sure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An Amazon Aurora MySQL instance.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt; installed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1 - Deploy Bytebase via Docker
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Make sure your Docker is running, and start the Bytebase Docker container with following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--platform&lt;/span&gt; linux/amd64 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--restart&lt;/span&gt; always &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--publish&lt;/span&gt; 5678:8080 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-cmd&lt;/span&gt; &lt;span class="s2"&gt;"curl --fail http://localhost:5678/healthz || exit 1"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-interval&lt;/span&gt; 5m &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--health-timeout&lt;/span&gt; 60s &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--volume&lt;/span&gt; ~/.bytebase/data:/var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  bytebase/bytebase:1.13.0 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--data&lt;/span&gt; /var/opt/bytebase &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--port&lt;/span&gt; 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Bytebase is now running via Docker, and you can access it via &lt;code&gt;localhost:5678&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kJU-t_5e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/docker.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kJU-t_5e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/docker.webp" alt="docker" width="880" height="503"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Visit &lt;code&gt;localhost:5678&lt;/code&gt; in your browser. Register the first admin account which will be granted &lt;a href="https://www.bytebase.com/docs/concepts/roles-and-permissions"&gt;&lt;code&gt;Workspace Owner&lt;/code&gt;&lt;/a&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JQ5oP68J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-register.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JQ5oP68J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-register.webp" alt="bb-register" width="880" height="463"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 2 - Add an Amazon Aurora Instance to Bytebase
&lt;/h2&gt;

&lt;p&gt;In Bytebase, ​​an Instance could be your on-premises MySQL instance, an AWS RDS instance etc, in this tutorial, ​an &lt;strong&gt;Instance&lt;/strong&gt; is your &lt;code&gt;Amazon Aurora MySQL instance&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Visit &lt;code&gt;localhost:5678&lt;/code&gt; and log in as &lt;code&gt;Workspace Owner&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Lx8ETN95--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-login.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lx8ETN95--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-login.webp" alt="bb-login" width="880" height="449"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Add Instance&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NUEMj17G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-home-add-instance.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NUEMj17G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-home-add-instance.webp" alt="bb-home-add-instance" width="880" height="428"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill in the fields and click &lt;strong&gt;Create&lt;/strong&gt;. Pay attention to these fields:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Type&lt;/strong&gt;: &lt;code&gt;MySQL&lt;/code&gt;, if you use Aurora PostgreSQL, choose &lt;code&gt;PostgreSQL&lt;/code&gt; instead.&lt;br&gt;
&lt;strong&gt;Environment&lt;/strong&gt;: choose &lt;code&gt;Test&lt;/code&gt;, if you choose &lt;code&gt;Prod&lt;/code&gt;, you'll need manual approval for all future change requests by default, let's keep it simple for this tutorial.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A42WuEAw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-create-instance.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A42WuEAw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-create-instance.webp" alt="bb-create-instance" width="880" height="1117"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 - Create a Project
&lt;/h2&gt;

&lt;p&gt;In Bytebase, &lt;strong&gt;Project&lt;/strong&gt; groups logically-related &lt;strong&gt;Databases, Issues&lt;/strong&gt; and &lt;strong&gt;Users&lt;/strong&gt; together, which is similar to the project concept in other DevTools such as Jira and GitLab. So before you deal with the database, a Project must be created.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Projects&lt;/strong&gt; on the top navigation bar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;New Project&lt;/strong&gt; to create a new project &lt;code&gt;TestAurora&lt;/code&gt;, key is &lt;code&gt;TAR&lt;/code&gt;, mode is &lt;code&gt;standard&lt;/code&gt;. Click &lt;strong&gt;Create&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pIYgcvzW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-projects-new-project.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pIYgcvzW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-projects-new-project.webp" alt="bb-projects-new-project" width="880" height="452"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 4 - Create an Amazon Aurora Database via Bytebase
&lt;/h2&gt;

&lt;p&gt;In Bytebase, a &lt;strong&gt;Database&lt;/strong&gt; is created by &lt;code&gt;CREATE DATABASE xxx&lt;/code&gt;. A database always belongs to a single &lt;strong&gt;Project&lt;/strong&gt;. An &lt;strong&gt;Issue&lt;/strong&gt; represents a specific collaboration activity between Developer and DBA for when creating a database, altering a schema. It's similar to the issue concept in other issue management tools.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Projects&lt;/strong&gt; &amp;gt; &lt;code&gt;TestAurora&lt;/code&gt; on the left sidebar. Click &lt;strong&gt;New DB&lt;/strong&gt; to create a new database. You can transfer your existing &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill the form with &lt;strong&gt;Name&lt;/strong&gt; - &lt;code&gt;db_demo&lt;/code&gt;, &lt;strong&gt;Environment&lt;/strong&gt; - &lt;code&gt;Test&lt;/code&gt;, and &lt;strong&gt;Instance&lt;/strong&gt; - &lt;code&gt;Amazon Aurora MySQL&lt;/code&gt;. Click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bytebase will create an issue to create the database automatically. As it's the &lt;code&gt;Test&lt;/code&gt; environment, the issue will run without waiting for your approval by default. Click &lt;strong&gt;Resolve&lt;/strong&gt;, and the issue is &lt;code&gt;Done&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yxGoHJjh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-create-dbdemo.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yxGoHJjh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-create-dbdemo.webp" alt="bb-issue-create-dbdemo" width="880" height="428"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 5 - Create a Table in Amazon Aurora MySQL
&lt;/h2&gt;

&lt;p&gt;In Step 4, you created an issue to create a database using UI workflow and then executed it. Let’s continue to create a table.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Visit your project, and click on &lt;strong&gt;Alter Schema&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;code&gt;db_demo&lt;/code&gt;  and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bgF3tpxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-alter-schema-select-db.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bgF3tpxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-alter-schema-select-db.webp" alt="bb-alter-schema-select-db" width="880" height="357"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This is where you get to try out the &lt;strong&gt;Schema Editor&lt;/strong&gt;. It’s a visual editor for schema changes. Create a table called &lt;code&gt;t1&lt;/code&gt; with 2 columns: &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;name&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g3RerY8T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-schema-editor.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g3RerY8T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-schema-editor.webp" alt="bb-schema-editor" width="880" height="399"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Preview issue&lt;/strong&gt;, and Bytebase will automatically preview an issue with the corresponding SQL statement. Verify it's right, and click &lt;strong&gt;Create&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y-1RAQBj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-create-t1.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y-1RAQBj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-create-t1.webp" alt="bb-issue-create-t1" width="880" height="414"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The issue is automatically approved by default since it’s for the &lt;code&gt;Test&lt;/code&gt; environment. Meanwhile, Bytebase has  run several task checks before executing the SQL, and one such task check is called SQL Reivew. You may &lt;a href="https://dev.to/docs/sql-review/review-policy/overview"&gt;customize your own SQL Review policies&lt;/a&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--an4gIxzD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-task-checks.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--an4gIxzD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-task-checks.webp" alt="bb-task-checks" width="880" height="466"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Resolve issue&lt;/strong&gt;. The issue will become &lt;code&gt;Done&lt;/code&gt; .&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L4WEpQ6G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-t1-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L4WEpQ6G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-t1-done.webp" alt="bb-issue-t1-done" width="880" height="466"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From the issue page, click &lt;strong&gt;View change&lt;/strong&gt;, and you can see schema diff.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mw2Wd9nw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-change-diff-t1.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mw2Wd9nw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-change-diff-t1.webp" alt="bb-change-diff-t1" width="880" height="501"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 6 - Add Some Data and Query via SQL Editor
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to the project &lt;code&gt;TestAurora&lt;/code&gt; , and click &lt;strong&gt;Change Data&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;code&gt;db_demo&lt;/code&gt;  and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Fill in the SQL as follows and then click &lt;strong&gt;Create&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt;
  &lt;span class="n"&gt;t1&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Adela'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;After its execution, Click &lt;strong&gt;Resolve&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---gaDMSN5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-insert-data-done.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---gaDMSN5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-insert-data-done.webp" alt="bb-issue-insert-data-done" width="880" height="451"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;SQL Editor&lt;/strong&gt; on the left side bar. Input the query and click &lt;strong&gt;Run&lt;/strong&gt;. You can see the new row is there.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JW5du8zj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-select-1.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JW5du8zj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-select-1.webp" alt="bb-sql-editor-select-1" width="880" height="567"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 7 - Rollback the Data Change
&lt;/h2&gt;

&lt;p&gt;Bytebase support &lt;a href="https://www.bytebase.com/docs/change-database/rollback-data-changes"&gt;Rollback for MySQL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After a data change completes, Bytebase can parse MySQL binary logs and build rollback SQL statements from the logs. This allows you to revert that data change if needed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go back to the issue, turn the &lt;strong&gt;SQL Rollback&lt;/strong&gt; on.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2gpGPpKI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-before-rollback.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2gpGPpKI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-before-rollback.webp" alt="bb-issue-before-rollback" width="880" height="450"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It may fail if the instance hasn't set &lt;code&gt;binlog_format = ROW&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y7HBmHBz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-rollback-fail.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y7HBmHBz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-rollback-fail.webp" alt="bb-issue-rollback-fail" width="880" height="449"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to Amazon RDS, click &lt;strong&gt;Parameter groups&lt;/strong&gt; to create a new parameter group and set &lt;strong&gt;binlog_format&lt;/strong&gt; to &lt;code&gt;ROW&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jCpJU3gR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/aws-create-param.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jCpJU3gR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/aws-create-param.webp" alt="aws-create-param" width="880" height="525"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cWabC0Dj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/aws-param-row.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cWabC0Dj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/aws-param-row.webp" alt="aws-param-row" width="880" height="413"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apply the parameter group to your database instance.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zR2KEOUI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/aws-apply-param-group-bb.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zR2KEOUI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/aws-apply-param-group-bb.webp" alt="aws-apply-param-group-bb" width="880" height="543"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go back to Bytebase &lt;strong&gt;SQL Editor&lt;/strong&gt;, and switch to &lt;strong&gt;Admin Mode&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CoXkorDx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-admin.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CoXkorDx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-admin.webp" alt="bb-sql-editor-admin" width="880" height="511"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;According to &lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/mysql-stored-proc-configuring.html#mysql_rds_show_configuration"&gt;Amazon documentation&lt;/a&gt;. Type as following to set the binlog retention hours to 24.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;call&lt;/span&gt; &lt;span class="n"&gt;mysql&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rds_set_configuration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'binlog retention hours'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Type as following to check it's set successfully.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CALL&lt;/span&gt; &lt;span class="n"&gt;mysql&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rds_show_configuration&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hgDQIPtD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-admin-show-config.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hgDQIPtD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-admin-show-config.webp" alt="bb-sql-editor-admin-show-config" width="880" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Reboot the Aurora MySQL instance.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q9MzzoIh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/aws-reboot.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q9MzzoIh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/aws-reboot.webp" alt="aws-reboot" width="880" height="434"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Repeat the Step 6, but this time, we can see the &lt;strong&gt;Preview rollback issue&lt;/strong&gt;. Click it and then click &lt;strong&gt;Create&lt;/strong&gt; on the issue page.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DMssPSeV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-before-rollback-preview.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DMssPSeV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-before-rollback-preview.webp" alt="bb-issue-before-rollback-preview" width="880" height="443"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IeJvy3LW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-rollback-preview.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IeJvy3LW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-rollback-preview.webp" alt="bb-issue-rollback-preview" width="880" height="441"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rollback always requires explicit approval.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--40J5XtQH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-rollback-to-approve.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--40J5XtQH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-rollback-to-approve.webp" alt="bb-issue-rollback-to-approve" width="880" height="441"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Before approving rollback, let's go to &lt;strong&gt;SQL Editor&lt;/strong&gt; and query. &lt;code&gt;Bella&lt;/code&gt; is there.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pvqO6MHX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/blog/database-change-management-with-amazon-aurora/bb-sql-editor-query-2.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pvqO6MHX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/blog/database-change-management-with-amazon-aurora/bb-sql-editor-query-2.webp" alt="bb-sql-editor-query-2" width="880" height="485"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go back to the issue page and click &lt;strong&gt;Approve&lt;/strong&gt;. The rollback SQL will execute.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tEK3cP_n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-rollback-executed.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tEK3cP_n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-issue-rollback-executed.webp" alt="bb-issue-rollback-executed" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;strong&gt;SQL Editor&lt;/strong&gt; and query again. &lt;code&gt;Bella&lt;/code&gt; is no longer there - The rollback is successful. You may rollback the rollback too, and yes, rollback the rollback for rollback... As long as the binlog is within the 24-hour retention period.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IYGthL5L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-query-3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IYGthL5L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-query-3.webp" alt="bb-sql-editor-query-3" width="880" height="473"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Bonus Section - Schema Drift Detection
&lt;/h2&gt;

&lt;p&gt;To follow this section, you need to activate the &lt;strong&gt;Enterprise Plan&lt;/strong&gt; (you can start a 14-day trial directly, no credit card required).&lt;/p&gt;

&lt;p&gt;Now you can see the full change history of database &lt;code&gt;db_demo&lt;/code&gt;. However, what is &lt;strong&gt;Establish new baseline&lt;/strong&gt;? When to use it?&lt;/p&gt;

&lt;p&gt;By adopting Bytebase, we expect teams to use Bytebase exclusively for all schema changes. Meanwhile, if someone has made Amazon Aurora schema change out side of Bytebase, obviously Bytebase won’t know it. And because Bytebase has recorded its own copy of schema, when Bytebase compares that with the live schema having that out-of-band schema change, it will notice a discrepancy and surface a schema drift anomaly. If that change is intended, then you should establish new baseline to reconcile the schema state again.&lt;/p&gt;

&lt;p&gt;In this section, you’ll be guided through this process.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You can use an external GUI or terminal to make a change to &lt;code&gt;db_demo&lt;/code&gt; . In this tutorial, we use Bytebase &lt;strong&gt;SQL Editor’s Admin mode&lt;/strong&gt; which also counts when we say &lt;strong&gt;change outside of Bytebase&lt;/strong&gt;. Go to &lt;strong&gt;SQL Editor&lt;/strong&gt;, and switch to &lt;strong&gt;Admin mode&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When you make a change in &lt;strong&gt;Admin Mode&lt;/strong&gt;, it will not record any history as in a normal process &lt;a href="https://www.bytebase.com/docs/sql-editor/admin-mode"&gt;www.bytebase.com/docs/sql-editor/admin-mode&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CoXkorDx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-admin.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CoXkorDx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-admin.webp" alt="bb-sql-editor-admin" width="880" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Paste the following and then press &lt;strong&gt;Enter&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;t1&lt;/span&gt;
&lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;COLUMN&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="nb"&gt;integer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Paste the following and then press &lt;strong&gt;Enter&lt;/strong&gt; to verify it’s there:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; 
  &lt;span class="k"&gt;table_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;column_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;data_type&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;
  &lt;span class="n"&gt;information_schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt;
  &lt;span class="k"&gt;table_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'t1'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I3ETznua--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-admin-age.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I3ETznua--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-sql-editor-admin-age.webp" alt="bb-sql-editor-admin-age" width="880" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Wait for 10 mins (as Bytebase does the check roughly every 10 mins). Go to &lt;strong&gt;Anomaly Center&lt;/strong&gt;, and you can find the &lt;strong&gt;Schema Drift&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lb73DEyY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-ac-schema-drift.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lb73DEyY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-ac-schema-drift.webp" alt="bb-ac-schema-drift" width="880" height="472"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on &lt;strong&gt;View diff&lt;/strong&gt;, you will see the exact drift.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0lZW_n2B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-drift-age.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0lZW_n2B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-drift-age.webp" alt="bb-drift-age" width="880" height="295"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You may also find the drift by clicking &lt;strong&gt;Databases&lt;/strong&gt; &amp;gt; &lt;strong&gt;db_demo&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cvWvlqIo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-dbdemo-drift.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cvWvlqIo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-dbdemo-drift.webp" alt="bb-dbdemo-drift" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;strong&gt;Databases&lt;/strong&gt; &amp;gt; &lt;strong&gt;db_demo&lt;/strong&gt; &amp;gt; &lt;strong&gt;Change History&lt;/strong&gt; and click &lt;strong&gt;Establish new baseline&lt;/strong&gt;, this step establishes a new baseline to reconcile the schema state from the live database schema.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7zOz0agM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-dbdemo-new-baseline.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7zOz0agM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bytebase.com/static/blog/database-change-management-with-amazon-aurora/bb-dbdemo-new-baseline.webp" alt="bb-dbdemo-new-baseline" width="880" height="474"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bytebase will create an issue to establish the new baseline, click &lt;strong&gt;Create&lt;/strong&gt;, and then &lt;strong&gt;Resolve&lt;/strong&gt; to mark it done.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go back to &lt;strong&gt;Databases&lt;/strong&gt; &amp;gt; &lt;strong&gt;db_demo&lt;/strong&gt; or &lt;strong&gt;Anomaly Center&lt;/strong&gt;, and you will find the drift is gone.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary and What's Next
&lt;/h2&gt;

&lt;p&gt;Now you have connected Amazon Aurora with Bytebase, and used the UI workflow to accomplish schema change and data change. Bytebase will record the full change history for you. Furthermore, the &lt;strong&gt;Enterprise Plan&lt;/strong&gt; is equipped with &lt;strong&gt;Schema Drift Detection&lt;/strong&gt; to detect out-of-band schema changes performed outside of Bytebase.&lt;/p&gt;

&lt;p&gt;In the next post, you’ll try out GitOps workflow: store your Amazon Aurora schema in GitHub and Bytebase will pick up the changes to the repo, bringing your Amazon Aurora change workflow to the next level, aka &lt;strong&gt;Database DevOps&lt;/strong&gt; - &lt;a href="https://www.bytebase.com/blog/database-as-code"&gt;Database as Code&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>aurora</category>
      <category>database</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
