Skip to content

Commit

Permalink
Test adding a test_field for versioned migration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
james03160927 committed May 28, 2024
1 parent e426869 commit 72828fd
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 17 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/migration-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Atlas CI
on:
# Run whenever code is changed in the main branch,
# change this to your root branch.
# push:
# branches:
# - main
push:
branches:
- main
# Run on PRs where something changed under the `ent/migrate/migrations/` directory.
pull_request:
paths:
- 'ent/migrate/migrations/*'
- 'ent/migrate/migrations/**'
jobs:
lint:
services:
Expand All @@ -30,8 +29,18 @@ jobs:
- uses: actions/[email protected]
with:
fetch-depth: 0 # Mandatory unless "latest" is set below.
- uses: ariga/atlas-action@v0
- uses: ariga/atlas-action@v1.0.11
with:
dir: ent/migrate/migrations
dir-format: golang-migrate # Or: atlas, goose, dbmate
dev-url: postgres://postgres:pass@localhost:5432/test?sslmode=disable
dev-url: postgres://postgres:pass@localhost:5432/test?sslmode=disable

- name: Check for migration changes
id: check_migrations
run: |
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^ent/schema'; then
if ! git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^ent/migrate/migrations'; then
echo "::error::Changes in 'ent/schema' require corresponding changes in 'ent/migrate/migrations'"
exit 1
fi
fi
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ Or manually run:

`go run -mod=mod entgo.io/ent/cmd/ent generate --feature sql/upsert --feature sql/lock ./ent/schema`

### Generate Migration Files

Run this command to generate migration files needed for staging/prod database schema changes:

```shell
atlas migrate diff migration \
--dir "file://ent/migrate/migrations" \
--to "ent://ent/schema" \
--dev-url "docker://postgres/15/test?search_path=public"
```

## API Spec Change (openapi.yml)

### Regenerate code
Expand Down
3 changes: 2 additions & 1 deletion ent/migrate/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 71 additions & 1 deletion ent/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion ent/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions ent/node/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions ent/node_create.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 72828fd

Please sign in to comment.