mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
example/migration: improve atlas migration example (#3092)
This commit is contained in:
@@ -12,19 +12,25 @@ Versioned migration files exists under `ent/migrate/migrations` and follows the
|
||||
|
||||
2\. Run `go generate ./ent`
|
||||
|
||||
|
||||
### Generate new versioned migration
|
||||
|
||||
1\. Create a dev-database container if there is no one.
|
||||
|
||||
```shell
|
||||
docker run --name migration --rm -p 3306:3306 -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_DATABASE=test -d mysql
|
||||
```
|
||||
|
||||
2\. Generate a new versioned migration file:
|
||||
|
||||
```go
|
||||
go run -mod=mod ent/migrate/main.go <name>
|
||||
```
|
||||
|
||||
### Run linting
|
||||
### Run migration linting
|
||||
|
||||
```bash
|
||||
go run -mod=mod ariga.io/atlas/cmd/atlas@master migrate lint \
|
||||
go run -mod=mod ariga.io/atlas/cmd/atlas@latest migrate lint \
|
||||
--dev-url="mysql://root:pass@localhost:3306/test" \
|
||||
--dir="file://ent/migrate/migrations" \
|
||||
--dir-format="golang-migrate" \
|
||||
--latest=1
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user