https://github.com/dwin/dbmate-action
Github Action for Dbmate database migration tool
https://github.com/dwin/dbmate-action
database-migration database-migrations dbmate github-action github-actions github-actions-docker
Last synced: 24 days ago
JSON representation
Github Action for Dbmate database migration tool
- Host: GitHub
- URL: https://github.com/dwin/dbmate-action
- Owner: dwin
- License: mit
- Created: 2022-10-21T20:26:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-17T17:10:58.000Z (over 1 year ago)
- Last Synced: 2026-04-01T01:07:28.492Z (about 1 month ago)
- Topics: database-migration, database-migrations, dbmate, github-action, github-actions, github-actions-docker
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# dbmate-action
This repository contains a GitHub Action for running [Dbmate](https://github.com/amacneil/dbmate), used
for database migrations.
It is based on the [official Github Docker image](https://github.com/amacneil/dbmate/pkgs/container/dbmate),
which is based on Alpine Linux.
## Inputs
### `command`
The command to run. Default `"--help"`, but you'll likely want to use `"up"`.
See [Dbmate documentation](https://github.com/amacneil/dbmate#commands) for commands.
## Example usage
See [https://github.com/amacneil/dbmate#command-line-options](https://github.com/amacneil/dbmate#command-line-options)
for more configuration options to be passed by environment variables.
### Basic Usage
Uses the default command `up` and does not check in the database schema.
```yaml
...
steps:
- name: "Run migrations"
uses: dwin/dbmate-action@v1.15
with:
command: 'up'
env:
DATABASE_URL: postgres://postgres:changeme@postgres:5432/postgres # or ${{ secrets.DATABASE_URL }}
DBMATE_MIGRATIONS_DIR: "./migrations"
DBMATE_NO_DUMP_SCHEMA: "true"
DBMATE_WAIT: "true"
DBMATE_WAIT_TIMEOUT: "30s"
...
```
### Check in the database schema
```yaml
...
steps:
- name: "Run migrations"
uses: dwin/dbmate-action@v1.15
with:
command: 'up'
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
DBMATE_MIGRATIONS_DIR: "./migrations"
DBMATE_SCHEMA_FILE: "./schema.sql"
DBMATE_WAIT: "true"
DBMATE_WAIT_TIMEOUT: "30s"
- name: "Add & Commit latest schema"
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
...
```