Update the README / dev process explanation

This commit is contained in:
Grégoire Delattre 2016-05-24 04:31:34 +02:00
parent 827ab41df5
commit 7dd1eba942
6 changed files with 26 additions and 2 deletions

View File

@ -7,8 +7,29 @@ Just run the docker-compose file to create the database.
docker-compose up -d
```
## Dev
## Run the tests
### 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
```

View File

@ -5,5 +5,7 @@ postgresql:
environment:
- POSTGRES_PASSWORD=test
- POSTGRES_USER=test
volumes:
- .:/docker-entrypoint-initdb.d/
ports:
- 127.0.0.1:5432:5432

1
docker/init.sql Normal file
View File

@ -0,0 +1 @@
CREATE DATABASE dev;

View File

@ -23,7 +23,7 @@ func (b *UserBackend) Get(username string) (auth.User, error) {
func main() {
log := logrus.NewEntry(logrus.New())
pgdsn := "postgres://test:test@127.0.0.1:5432/test?sslmode=disable"
pgdsn := "postgres://test:test@127.0.0.1:5432/dev?sslmode=disable"
db, err := sqlx.Connect("postgres", pgdsn)
if err != nil {
log.Panic(err)