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" 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