sqlx_migrator 0.18.0

Migrator for writing sqlx migration using Rust instead of SQL
Documentation
name: Build

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build:
    name: Build
    strategy:
      matrix:
        include:
          - os: "ubuntu-latest"
            rust-version: "stable"
          - os: "macos-latest"
            rust-version: "stable"
          - os: "windows-latest"
            rust-version: "stable"
          - os: "ubuntu-latest"
            rust-version: "beta"
          - os: "ubuntu-latest"
            rust-version: "nightly"
    runs-on: ${{ matrix.os }}
    env:
      MAKE_FEATURES_FLAG: "--all-features"
    defaults:
      run:
        shell: bash

    steps:
      - uses: actions/checkout@v4
      - name: Setup rust toolchain
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust-version }}
          components: rustfmt, clippy
      - name: Install cargo make
        uses: davidB/rust-cargo-make@v1.10.0
      - name: Create env file
        uses: iamsauravsharma/create-dotenv@v3.0.0
        with:
          input-prefix: "MAKE_"
      - name: Run tests
        run: |
          cargo make --env-file=.env full

  run_example:
    name: Run Example
    runs-on: "ubuntu-latest"
    needs: build
    env:
      SQLITE_DATABASE_URL: "db.sqlite3"
      POSTGRES_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/postgres
      MYSQL_DATABASE_URL: mysql://root:mysql@127.0.0.1:3306/default_db
    services:
      postgres:
        image: postgres
        env:
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
      mysql:
        image: mysql
        env:
          MYSQL_ROOT_PASSWORD: mysql
          MYSQL_DATABASE: default_db
        ports:
          - 3306:3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - uses: actions/checkout@v4
      - name: Setup rust toolchain
        uses: dtolnay/rust-toolchain@nightly
      - name: Install cargo make
        uses: davidB/rust-cargo-make@v1
      - name: Print cli help message
        run: |
          cargo make run_postgres_example --help
          cargo make run_postgres_example apply --help
          cargo make run_postgres_example drop --help
          cargo make run_postgres_example list --help
          cargo make run_postgres_example revert --help
      - name: Run postgres example
        run: |
          cargo make run_postgres_example apply
          cargo make run_postgres_example list
          cargo make run_postgres_example revert --all --force
          cargo make run_postgres_example list
          cargo make run_postgres_example drop
      - name: Run sqlite example
        run: |
          touch db.sqlite3
          cargo make run_sqlite_example apply
          cargo make run_sqlite_example list
          cargo make run_sqlite_example revert --all --force
          cargo make run_sqlite_example list
          cargo make run_sqlite_example drop
      - name: Run mysql example
        run: |
          cargo make run_mysql_example apply
          cargo make run_mysql_example list
          cargo make run_mysql_example revert --all --force
          cargo make run_mysql_example list
          cargo make run_mysql_example drop