mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
doc/versioned: more examples on how to install and execute migrate lint (#3249)
This commit is contained in:
@@ -466,13 +466,120 @@ Let's run `atlas migrate lint` with the necessary parameters to run migration li
|
||||
- (optional) `--latest` run analysis on the latest `N` migration files.
|
||||
- (optional) `--git-base` run analysis against the base Git branch.
|
||||
|
||||
```bash
|
||||
go run -mod=mod ariga.io/atlas/cmd/atlas@master migrate lint \
|
||||
--dev-url="mysql://root:pass@localhost:3306/test" \
|
||||
#### Install Atlas:
|
||||
|
||||
To install the latest release of Atlas, simply run one of the following in your terminal, or check out the
|
||||
[Atlas website](https://atlasgo.io/getting-started#installation):
|
||||
|
||||
<Tabs
|
||||
defaultValue="apple-intel-plain+linux"
|
||||
values={[
|
||||
{label: 'macOS + Linux', value: 'apple-intel-plain+linux'},
|
||||
{label: 'Homebrew', value: 'apple-intel-brew'},
|
||||
{label: 'Go', value: 'go'},
|
||||
{label: 'Docker', value: 'docker'},
|
||||
{label: 'Windows', value: 'windows'},
|
||||
]}>
|
||||
<TabItem value="apple-intel-plain+linux">
|
||||
|
||||
```shell
|
||||
curl -sSf https://atlasgo.sh | sh
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="apple-intel-brew">
|
||||
|
||||
```shell
|
||||
brew install ariga/tap/atlas
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="go">
|
||||
|
||||
```shell
|
||||
go install ariga.io/atlas/cmd/atlas@master
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="docker">
|
||||
|
||||
```shell
|
||||
docker pull arigaio/atlas
|
||||
docker run --rm arigaio/atlas --help
|
||||
```
|
||||
|
||||
If the container needs access to the host network or a local directory, use the `--net=host` flag and mount the desired
|
||||
directory:
|
||||
|
||||
```shell
|
||||
docker run --rm --net=host \
|
||||
-v $(pwd)/migrations:/migrations \
|
||||
arigaio/atlas migrate apply
|
||||
--url "mysql://root:pass@:3306/test"
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="windows">
|
||||
|
||||
Download the [latest release](https://release.ariga.io/atlas/atlas-windows-amd64-latest.exe) and
|
||||
move the atlas binary to a file location on your system PATH.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
#### Run the `atlas migrate lint` command:
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultValue="mysql"
|
||||
values={[
|
||||
{label: 'MySQL', value: 'mysql'},
|
||||
{label: 'MariaDB', value: 'maria'},
|
||||
{label: 'PostgreSQL', value: 'postgres'},
|
||||
{label: 'SQLite', value: 'sqlite'},
|
||||
]}>
|
||||
<TabItem value="mysql">
|
||||
|
||||
```shell
|
||||
atlas migrate lint \
|
||||
--dev-url="docker://mysql/8/test" \
|
||||
--dir="file://ent/migrate/migrations" \
|
||||
--latest=1
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="maria">
|
||||
|
||||
```shell
|
||||
atlas migrate lint \
|
||||
--dev-url="docker://mariadb/latest/test" \
|
||||
--dir="file://ent/migrate/migrations" \
|
||||
--latest=1
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="postgres">
|
||||
|
||||
```shell
|
||||
atlas migrate lint \
|
||||
--dev-url="docker://postgres/15/test?search_path=public" \
|
||||
--dir="file://ent/migrate/migrations" \
|
||||
--latest=1
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="sqlite">
|
||||
|
||||
```shell
|
||||
atlas migrate lint \
|
||||
--dev-url="sqlite://file?mode=memory" \
|
||||
--dir="file://ent/migrate/migrations" \
|
||||
--latest=1
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
An output of such a run might look as follows:
|
||||
|
||||
```text {3,7}
|
||||
|
||||
Reference in New Issue
Block a user