Skip to content

Github Action for Dbmate database migration tool

License

Notifications You must be signed in to change notification settings

teaforchris/dbmate-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dbmate-action

This repository contains a GitHub Action for running Dbmate, used for database migrations.

It is based on the official Github Docker image, 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 for commands.

Example usage

See 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.

...
steps:
  - name: "Run migrations"
    uses: dwin/[email protected]
    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

...
steps:
  - name: "Run migrations"
    uses: dwin/[email protected]
    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
...

About

Github Action for Dbmate database migration tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published