Skip to content

Test the migration with TiDB Serverless branching #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/migrate.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions db/migrate/20230906065509_add_index_to_article.rb
Original file line number Diff line number Diff line change
@@ -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