GitHub database migration action
🎲 :octocat: A GitHub Action to manage versioned database migrations across multiple database drivers.
Usage
Parameters
OPERATION(required) The operation to be executed (one of:dry-run,migrate,check, orintegrity)DRIVER(required) The driver to use (one of:mysql,mariadb,postgresql,mssqlororacle11g)HOST(required) The database host address (domain or IPv4).USER(required) The username to connect to the database host.DATABASE(required) The database name.INTEGRITY_COMMANDS_FILE(optional) When theOPERATIONisintegrity, this parameter receives the file with a list (one per line) of commands to run and validate the presence of data in the database.
Environment variables
DATABASE_PWD(optional) The password to connect to the database host. Set as an environment variable to keep it secure.
Outputs
None.
Example
name: "test"
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run the action
uses: guibranco/github-database-migration-action@latest
env:
DATABASE_PWD: $ # Pass the password as an environment variable to keep it secret.
with:
OPERATION: migrate
DRIVER: mysql
HOST: 127.0.0.1
USER: test
DATABASE: test