From 3487a7a8b09c8d2386c40f1a9ef157299345f4bf Mon Sep 17 00:00:00 2001 From: "steve.svt" Date: Thu, 10 Apr 2025 10:35:35 +0700 Subject: [PATCH 1/6] testing --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8728f9c..2dbed5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,8 +22,8 @@ jobs: runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks. environment: test env: - BYTEBASE_URL: https://demo.bytebase.com - BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com + BYTEBASE_URL: https://github.com/songtvo/example-gitops-github-flow + BYTEBASE_SERVICE_ACCOUNT: api-sample@service.bytebase.com BYTEBASE_PROJECT: "projects/project-sample" # The Bytebase rollout pipeline will deploy to 'test' and 'prod' environments. # 'deploy-to-test' job rollouts the 'test' stage and 'deploy-to-prod' job rollouts the 'prod' stage. From 8756c733667b4b26cc418cb05bceaa095caa1a9a Mon Sep 17 00:00:00 2001 From: "steve.svt" Date: Thu, 10 Apr 2025 10:43:12 +0700 Subject: [PATCH 2/6] testing --- ...07221559__create_users_roles_table_ddl.sql | 14 ++++++ ...e_client_account_and_company_table_ddl.sql | 46 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 migrations/202407221559__create_users_roles_table_ddl.sql create mode 100644 migrations/202408061521__create_client_account_and_company_table_ddl.sql diff --git a/migrations/202407221559__create_users_roles_table_ddl.sql b/migrations/202407221559__create_users_roles_table_ddl.sql new file mode 100644 index 0000000..bbb3af9 --- /dev/null +++ b/migrations/202407221559__create_users_roles_table_ddl.sql @@ -0,0 +1,14 @@ +CREATE TABLE users +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + user_id VARCHAR(50) NOT NULL UNIQUE, + email VARCHAR(100) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL UNIQUE, + is_not_locked BOOLEAN DEFAULT TRUE, + is_temporary_password BOOLEAN DEFAULT TRUE, + avatar VARCHAR(255), + created_date DATETIME, + created_by VARCHAR(36), + updated_date DATETIME, + updated_by VARCHAR(36) +); \ No newline at end of file diff --git a/migrations/202408061521__create_client_account_and_company_table_ddl.sql b/migrations/202408061521__create_client_account_and_company_table_ddl.sql new file mode 100644 index 0000000..aa817dc --- /dev/null +++ b/migrations/202408061521__create_client_account_and_company_table_ddl.sql @@ -0,0 +1,46 @@ +CREATE TABLE client_account +( + id BIGINT PRIMARY KEY AUTO_INCREMENT, + client_account_id VARCHAR(20) NOT NULL UNIQUE, + client_account_name VARCHAR(100) NOT NULL, + address VARCHAR(250), + country VARCHAR(3), + state VARCHAR(50), + city VARCHAR(50), + postcode BIGINT, + phone_country_code VARCHAR(20), + phone VARCHAR(20), + email_address VARCHAR(70), + status VARCHAR(1), + start_date DATETIME NOT NULL, + contact_name VARCHAR(100), + contact_phone_country_code VARCHAR(20), + contact_phone VARCHAR(20), + contact_email_address VARCHAR(70), + client_common_db_name VARCHAR(255) NOT NULL UNIQUE, + created_date DATETIME, + created_by VARCHAR(36), + updated_date DATETIME, + updated_by VARCHAR(36) +); + + +CREATE TABLE company +( + id BIGINT PRIMARY KEY AUTO_INCREMENT, + client_id BIGINT NOT NULL, + company_code VARCHAR(50) NOT NULL, + it_company_code varchar(100) DEFAULT '' NOT NULL, + company_name VARCHAR(255) NOT NULL, + status VARCHAR(1), + company_db_name VARCHAR(255) NOT NULL UNIQUE, + created_date DATETIME, + created_by VARCHAR(36), + updated_date DATETIME, + updated_by VARCHAR(36), + CONSTRAINT uk_company_code_client_id UNIQUE (company_code, client_id) +); + +ALTER TABLE company + ADD CONSTRAINT fk_client_account FOREIGN KEY (client_id) REFERENCES client_account (id) + ON UPDATE CASCADE; \ No newline at end of file From d8053a61f53bdd0ab7feb26379066e59131aa008 Mon Sep 17 00:00:00 2001 From: songtvo Date: Thu, 10 Apr 2025 11:10:53 +0700 Subject: [PATCH 3/6] Update sql-review.yml --- .github/workflows/sql-review.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sql-review.yml b/.github/workflows/sql-review.yml index 59c0fbf..9959668 100644 --- a/.github/workflows/sql-review.yml +++ b/.github/workflows/sql-review.yml @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set GITHUB_TOKEN because the 'Check release' step needs it to comment the pull request with check results. - BYTEBASE_URL: https://demo.bytebase.com - BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com + BYTEBASE_URL: https://9d00-54-168-121-38.ngrok-free.app/ + BYTEBASE_SERVICE_ACCOUNT: api-example@service.bytebase.com BYTEBASE_PROJECT: "projects/project-sample" BYTEBASE_TARGETS: "instances/test-sample-instance/databases/hr_test" FILE_PATTERN: "migrations/*.sql" From 23278587a6a7e470ecf8c5207803ab689ffb6b95 Mon Sep 17 00:00:00 2001 From: "steve.svt" Date: Thu, 10 Apr 2025 11:14:21 +0700 Subject: [PATCH 4/6] config env --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2dbed5d..30f7870 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks. environment: test env: - BYTEBASE_URL: https://github.com/songtvo/example-gitops-github-flow + BYTEBASE_URL: https://9d00-54-168-121-38.ngrok-free.app/ BYTEBASE_SERVICE_ACCOUNT: api-sample@service.bytebase.com BYTEBASE_PROJECT: "projects/project-sample" # The Bytebase rollout pipeline will deploy to 'test' and 'prod' environments. @@ -46,7 +46,7 @@ jobs: id: create-release uses: bytebase/create-release-action@v1 with: - url: ${{ env.BYTEBASE_URL }} + url: https://9d00-54-168-121-38.ngrok-free.app/ token: ${{ steps.login.outputs.token }} file-pattern: ${{ env.FILE_PATTERN }} # fail the action if release checks report any error. From fd9ee26a4a09a3cf71bc057637f6fdad36bfc09a Mon Sep 17 00:00:00 2001 From: "steve.svt" Date: Thu, 10 Apr 2025 11:49:29 +0700 Subject: [PATCH 5/6] change byte base url --- .github/workflows/release.yml | 4 ++-- .github/workflows/sql-review.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30f7870..50396c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,8 +82,8 @@ jobs: runs-on: ubuntu-latest environment: prod env: - BYTEBASE_URL: https://demo.bytebase.com - BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com + BYTEBASE_URL: https://9d00-54-168-121-38.ngrok-free.app/ + BYTEBASE_SERVICE_ACCOUNT: api-sample@service.bytebase.com if: ${{ needs.deploy-to-test.outputs.deployment-required == 'true' }} steps: - name: Checkout diff --git a/.github/workflows/sql-review.yml b/.github/workflows/sql-review.yml index 9959668..1a4041e 100644 --- a/.github/workflows/sql-review.yml +++ b/.github/workflows/sql-review.yml @@ -46,8 +46,8 @@ jobs: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set GITHUB_TOKEN because the 'Check release' step needs it to comment the pull request with check results. - BYTEBASE_URL: https://demo.bytebase.com - BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com + BYTEBASE_URL: https://9d00-54-168-121-38.ngrok-free.app/ + BYTEBASE_SERVICE_ACCOUNT: api-example@service.bytebase.com BYTEBASE_PROJECT: "projects/project-sample" BYTEBASE_TARGETS: "instances/prod-sample-instance/databases/hr_prod" FILE_PATTERN: "migrations/*.sql" From f59767c0d10723f97c06588dd93f7f475a51b6f4 Mon Sep 17 00:00:00 2001 From: "steve.svt" Date: Thu, 10 Apr 2025 12:58:50 +0700 Subject: [PATCH 6/6] new table --- migrations/202510041257_create_new_table_ddl.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 migrations/202510041257_create_new_table_ddl.sql diff --git a/migrations/202510041257_create_new_table_ddl.sql b/migrations/202510041257_create_new_table_ddl.sql new file mode 100644 index 0000000..7619e4b --- /dev/null +++ b/migrations/202510041257_create_new_table_ddl.sql @@ -0,0 +1,14 @@ +CREATE TABLE bak_users +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + user_id VARCHAR(50) NOT NULL UNIQUE, + email VARCHAR(100) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL UNIQUE, + is_not_locked BOOLEAN DEFAULT TRUE, + is_temporary_password BOOLEAN DEFAULT TRUE, + avatar VARCHAR(255), + created_date DATETIME, + created_by VARCHAR(36), + updated_date DATETIME, + updated_by VARCHAR(36) +); \ No newline at end of file