Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/trip #30

Merged
merged 11 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Golang
uses: actions/setup-go@v4
with:
Expand All @@ -30,9 +31,11 @@ jobs:
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.DB_NAME }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}

- name: Database migration
- name: run migration
working-directory: ./server
run: make migrate
run: |
cp .env.sample .env
make migrate

- name: run test
working-directory: ./server
Expand Down
8 changes: 5 additions & 3 deletions server/.env.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
DB_HOST=localhost
DB_NAME=pm
DB_NAME=test
DB_USERNAME=root
DB_PASSWORD=password
DB_PORT=3305
DB_PASSWORD=root
DB_PORT=3306
ACCESS_TOKEN_SECRET=test-access-token
ACCESS_TOKEN_EXPIRED_AT=1000000
9 changes: 5 additions & 4 deletions server/cmd/migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ import (
"github.com/golang-migrate/migrate/v4"
_ "github.com/golang-migrate/migrate/v4/database/mysql"
_ "github.com/golang-migrate/migrate/v4/source/file"
"github.com/joho/godotenv"
)

func main() {
var direction string

// err := godotenv.Load()
// if err != nil {
// log.Fatal("failed to load .env file")
// }
err := godotenv.Load()
if err != nil {
log.Fatal("failed to load .env file")
}

flag.StringVar(&direction, "direction", "up", "migrate cmd: up or down")
flag.Parse()
Expand Down
Loading
Loading