38 lines
651 B
Markdown
38 lines
651 B
Markdown
## Setup the dev env
|
|
|
|
Just run the docker-compose file to create the database.
|
|
|
|
|
|
```
|
|
docker-compose up -d
|
|
```
|
|
|
|
## Dev
|
|
|
|
### Connect to the database
|
|
|
|
```
|
|
docker run -it --rm --link canape_postgresql_dev:postgres postgres:9.5 psql -h postgres -U test
|
|
```
|
|
|
|
Then connect to the database you wanna check :
|
|
|
|
```
|
|
\c dev
|
|
```
|
|
|
|
### Apply the migrations
|
|
|
|
```
|
|
migrate -url 'postgres://test:test@127.0.0.1:5432/dev?sslmode=disable' -path ./sql up
|
|
migrate -url 'postgres://test:test@127.0.0.1:5432/dev?sslmode=disable' -path ./sqltest up
|
|
```
|
|
|
|
|
|
### Run the tests
|
|
|
|
|
|
```
|
|
POSTGRES_DSN="postgres://test:test@127.0.0.1:5432/test?sslmode=disable" go test -v -p=1 ./...
|
|
```
|