-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (57 loc) · 2.16 KB
/
rails-add-association-foreign-key.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: rails-add-association-foreign-key
on:
schedule:
# Schedule: Runs at 9:00 AM and 1:00 PM Asia/Tokyo time (UTC+9) on weekdays (Monday to Friday).
- cron: "0 0,4 * * mon-fri"
workflow_dispatch:
jobs:
build-and-deploy-erd:
runs-on: ubuntu-latest
defaults:
run:
working-directory: samples/rails-add-association-foreign-key
permissions:
contents: read
deployments: write
# NOTE: for db tasks.
services:
postgres:
image: postgres:17.2
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_PASSWORD: password
steps:
- uses: actions/checkout@v4
# NOTE: for `bin/rails` command.
- name: Setup Ruby for samples/rails-add-association-foreign-key
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: samples/rails-add-association-foreign-key
- name: Apply migration
run: bin/rails db:create db:migrate
# appends `add_foreign_key` statements to `db/schema.rb`
# based on `belongs_to` associations defined in Active Record models.
# see also lib/tasks/append_foreign_key_to_db_schema_rb.rake.
- name: Add foreign_key to `db/schema.rb`
run: bin/rails append_foreign_key_to_db_schema_rb
# For check
- name: cat db/schema.rb
run: cat db/schema.rb
- name: Generate ER Diagrams
run: npx @liam-hq/cli erd build --input db/schema.rb --format schemarb
# For check
- name: ls -alF dist
run: ls -alF dist
# NOTE: For deploy, comment-in.
# see also other .github/workflows/ files.
# - name: Deploy ERD to Cloudflare Pages
# uses: cloudflare/wrangler-action@v3
# with:
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN_SAMPLE_PRISMA }}
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID_SAMPLE_PRISMA }}
# workingDirectory: samples/prisma-with-cloudflare-pages
# command: pages deploy ./dist --project-name=prisma-with-cloudflare-pages
# gitHubToken: ${{ secrets.GITHUB_TOKEN }}