From 2c30cb0e7f78534850eb8b1bf9ca2c934060b916 Mon Sep 17 00:00:00 2001 From: shiyuhang <1136742008@qq.com> Date: Sat, 30 Sep 2023 14:08:40 +0800 Subject: [PATCH 1/2] migration test --- .github/workflows/migrate.yml | 26 +++++++++++++++++++ .../20230906065509_add_index_to_article.rb | 6 +++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/migrate.yml create mode 100644 db/migrate/20230906065509_add_index_to_article.rb diff --git a/.github/workflows/migrate.yml b/.github/workflows/migrate.yml new file mode 100644 index 0000000..78a5e9a --- /dev/null +++ b/.github/workflows/migrate.yml @@ -0,0 +1,26 @@ +name: migrate-test + +on: + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: tidbcloud/wait-for-tidbcloud-branch@v0 + id: wait-for-branch + with: + token: ${{ secrets.GITHUB_TOKEN }} + public-key: ${{ secrets.TIDB_CLOUD_PUBLIC_KEY }} + private-key: ${{ secrets.TIDB_CLOUD_PRIVATE_KEY }} + timeout-seconds: 600 + + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - name: migrate-test + run: | + TIDB_USER=${{ steps.wait-for-branch.outputs.username }} TIDB_PASSWORD=${{ steps.wait-for-branch.outputs.password }} TIDB_HOST=${{ steps.wait-for-branch.outputs.host }} TIDB_CERT_PATH=/etc/ssl/certs/ca-certificates.crt rake db:migrate \ No newline at end of file diff --git a/db/migrate/20230906065509_add_index_to_article.rb b/db/migrate/20230906065509_add_index_to_article.rb new file mode 100644 index 0000000..51d12b3 --- /dev/null +++ b/db/migrate/20230906065509_add_index_to_article.rb @@ -0,0 +1,6 @@ +# bin/rails generate migration add_index_to_article title:uniq +class AddIndexToArticle < ActiveRecord::Migration[7.0] + def change + add_index :articles, :title, unique: true + end +end \ No newline at end of file From a80857faa0d49ce89b94496384b7bf8a911cf281 Mon Sep 17 00:00:00 2001 From: shiyuhang <1136742008@qq.com> Date: Sat, 7 Oct 2023 10:36:23 +0800 Subject: [PATCH 2/2] empty commit