-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/commands: add migrate apply (#17)
Need rebase before merge
- Loading branch information
Showing
3 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
description: > | ||
This command apply migrations to a database. | ||
parameters: | ||
url: | ||
type: string | ||
default: '' | ||
description: | | ||
The URL of the target database. For example: `mysql://root:pass@localhost:3306/dev`. | ||
dir: | ||
type: string | ||
default: "" | ||
description: | | ||
The URL of the migration directory to lint. For example: file://migrations. | ||
Read more about [Atlas URLs](https://atlasgo.io/concepts/url) | ||
config: | ||
type: string | ||
default: '' | ||
description: | | ||
The path to the Atlas configuration file. By default, Atlas will look for a file named `atlas.hcl` in the current directory. | ||
For example, `file://config/atlas.hcl`. Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects). | ||
vars: | ||
type: string | ||
default: '' | ||
description: | | ||
Extra variables to pass to the Atlas configuration file. For example, `key=value`. | ||
working_directory: | ||
type: string | ||
default: "." | ||
description: | | ||
The working directory to run from. Defaults to project root. | ||
env: | ||
type: string | ||
default: '' | ||
description: | | ||
The environment to use from the Atlas configuration file. For example, `dev`. | ||
dry_run: | ||
type: boolean | ||
default: false | ||
description: | | ||
Print SQL without executing it. Defaults to `false` | ||
steps: | ||
- run: | ||
name: Apply migrations to a database | ||
working_directory: <<parameters.working_directory>> | ||
command: atlasaction --action migrate/apply | ||
environment: | ||
INPUT_DIR: <<parameters.dir>> | ||
INPUT_CONFIG: <<parameters.config>> | ||
INPUT_ENV: <<parameters.env>> | ||
INPUT_DRY_RUN: <<parameters.dry_run>> | ||
INPUT_VARS: <<parameters.vars>> | ||
INPUT_URL: <<parameters.url>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters