Playing with Spring Boot; practicing
- CRUD
- Authorisation
- Integration testing with JGiven, TestContainers
I am assuming you want a disposible database like me. A database running in a docker container.
*** I chose not to write a dockerfile. I want you to SUFFER!!!!!!!!!!! ***
docker pull postgres
docker run --name <container_name> -e POSTGRES_PASSWORD=<password> -d -p 5432:5432 postgres
docker exec -it <containerName> psql -U postgres
To create a new db use,
CREATE USER <username> WITH PASSWORD '<password>';
If not you may use the default postgres User Create Database
CREATE DATABASE dbName OWNER <username>;
To list all DBs
\l
To quit
\q
To check if all is alright
docker logs <containerName>
!!! Be sure to configure the application.properties file(./src/main/resources
).
docker exec -it <containerName> bash
psql -U <username> <databaseName>
SELECT * FROM <tableName>;