feat: exercise CRUD (#9) #11
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
name: Database Migration | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install migration pkg | |
run: | | |
wget https://github.com/golang-migrate/migrate/releases/latest/download/migrate.linux-amd64.deb | |
sudo dpkg -i migrate.linux-amd64.deb | |
- name: Migrate | |
env: | |
DB_HOST: ${{ vars.DB_HOST }} | |
DB_PORT: ${{ vars.DB_PORT }} | |
DB_NAME: ${{ vars.DB_NAME }} | |
DB_USER: ${{ secrets.DB_USER }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
run: | | |
migrate -path db/migrations/ \ | |
-database "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}" \ | |
-verbose up |