You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
663 B

  1. SQL test
  2. ===
  3. ### Prerequisistes
  4. ```bash
  5. $ python3 -m pip install pipenv --user
  6. ```
  7. - Use virtualenv
  8. ```bash
  9. $ PIPENV_VENV_IN_PROJECT=true pipenv shell
  10. ```
  11. - Install dependencies
  12. ```bash
  13. $ pipenv install --dev
  14. ```
  15. ### Usage
  16. - Run up Postgresql server
  17. ```bash
  18. $ docker-compose up db
  19. ```
  20. - Stop Postgresql server
  21. ```bash
  22. $ docker-compose down
  23. ```
  24. - Connect to test database on Postgresql server using psql
  25. ```bash
  26. $ docker-compose exec db psql -U postgres test
  27. ```
  28. - Execute SQL file
  29. ```bash
  30. $ docker-compose exec db psql -v ON_ERROR_STOP=1 -U postgres test -a -f "sql/schema.sql"
  31. ```
  32. - Testing using database
  33. ```bash
  34. $ docker-compose up dbtest
  35. ```