From f3bc6d84ca8ebe92398cf56859328494ae4f30f0 Mon Sep 17 00:00:00 2001 From: Tianzhou Chen Date: Sat, 16 Mar 2024 01:51:39 +0800 Subject: [PATCH 1/2] chore: change script --- migrations/1001_create_user.down.sql | 1 + migrations/1001_create_user.up.sql | 7 +++++++ migrations/1002_create_post.down.sql | 1 + migrations/1002_create_post.up.sql | 5 +++++ 4 files changed, 14 insertions(+) create mode 100644 migrations/1001_create_user.down.sql create mode 100644 migrations/1001_create_user.up.sql create mode 100644 migrations/1002_create_post.down.sql create mode 100644 migrations/1002_create_post.up.sql diff --git a/migrations/1001_create_user.down.sql b/migrations/1001_create_user.down.sql new file mode 100644 index 0000000..3f8392b --- /dev/null +++ b/migrations/1001_create_user.down.sql @@ -0,0 +1 @@ +DROP TABLE "user"; \ No newline at end of file diff --git a/migrations/1001_create_user.up.sql b/migrations/1001_create_user.up.sql new file mode 100644 index 0000000..9faaf92 --- /dev/null +++ b/migrations/1001_create_user.up.sql @@ -0,0 +1,7 @@ +CREATE TABLE "user" ( + "id" SERIAL NOT NULL, + "firstName" character varying NOT NULL, + "lastName" character varying NOT NULL, + "age" integer NOT NULL, + CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id") +); \ No newline at end of file diff --git a/migrations/1002_create_post.down.sql b/migrations/1002_create_post.down.sql new file mode 100644 index 0000000..5fe4274 --- /dev/null +++ b/migrations/1002_create_post.down.sql @@ -0,0 +1 @@ +DROP TABLE post; \ No newline at end of file diff --git a/migrations/1002_create_post.up.sql b/migrations/1002_create_post.up.sql new file mode 100644 index 0000000..3520608 --- /dev/null +++ b/migrations/1002_create_post.up.sql @@ -0,0 +1,5 @@ +CREATE TABLE "post" ( + "id" SERIAL NOT NULL, + "author" TEXT NOT NULL, + CONSTRAINT "PK_cace4a159ff9f2512dd42373761" PRIMARY KEY ("id") +); \ No newline at end of file From 5679532c33dc9f5360f60e678d96e46a83f61771 Mon Sep 17 00:00:00 2001 From: Tianzhou Chen Date: Mon, 1 Apr 2024 23:38:07 +0800 Subject: [PATCH 2/2] chore: tweak flow --- .github/workflows/bytebase-upsert-migration.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/bytebase-upsert-migration.yml b/.github/workflows/bytebase-upsert-migration.yml index 86499f9..bcbf9a8 100644 --- a/.github/workflows/bytebase-upsert-migration.yml +++ b/.github/workflows/bytebase-upsert-migration.yml @@ -1,19 +1,17 @@ name: Upsert Migration on: - pull_request_review: - types: [submitted] - # pull_request: - # branches: - # - main - # paths: - # - "**/*.up.sql" + # pull_request_review: + # types: [submitted] + pull_request: + branches: + - main + paths: + - "**/*.up.sql" jobs: bytebase-upsert-migration: runs-on: ubuntu-latest - # Runs only if PR is approved and target branch is main - if: github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'main' env: BYTEBASE_URL: "https://bytebase-ci.zeabur.app" BYTEBASE_SERVICE_ACCOUNT: "ci@service.bytebase.com"