Skip to content

Commit

Permalink
Fix: PostgreSQL 16
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-touret committed Dec 13, 2023
1 parent 34853fb commit ae34d15
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,29 +156,38 @@ Here are commands to validate your environment:

```jshelllanguage
java -version
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode, sharing)
```

**Gradle**

If you use the wrapper, you won't have troubles. Otherwise...:

```jshelllanguage
gradle --version
gradle -version
------------------------------------------------------------
Gradle 8.5
------------------------------------------------------------
Build time: 2023-11-29 14:08:57 UTC
Revision: 28aca86a7180baa17117e0e5ba01d8ea9feca598
Welcome to Gradle 7.6!
Kotlin: 1.9.20
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 21.0.1 (Eclipse Adoptium 21.0.1+12-LTS)
OS: Linux 5.15.133.1-microsoft-standard-WSL2 amd64
```

**Docker Compose**

```jshelllanguage
docker compose version
Docker Compose version v2.12.2
Docker Compose version v2.22.2
```

#### :rocket: If you don't want to bother with a local setup
Expand All @@ -198,8 +207,8 @@ You have then to run the command in the shell:

```jshelllanguage
pip install httpie
sdk install java 17.0.5-tem
sdk default java 17.0.5-tem
sdk install java 21.0.1-tem
sdk default java 21.0.1-tem
```

## :boom: Ready ?
Expand Down
4 changes: 2 additions & 2 deletions docs/05-conflicts.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ import info.touret.bookstore.spring.book.repository.AuthorRepository;

### Import data

You can remove all the data located in [``import.sql``](../rest-book-2/src/main/resources/import.sql) and replace it by:
You can remove all the data located in [``import.sql.ORI``](../rest-book-2/src/main/resources/import.sql.ORI) and replace it by:

```sql
INSERT INTO author(id,firstname,lastname,public_id) VALUES (1000,'Antonio','Concalves','7c11e1bf-1c74-4280-812b-cbc6038b7d21');
Expand Down Expand Up @@ -452,7 +452,7 @@ public interface BookMapper {

### Import Data

Copy paste the [v2 ``import.sql``](../rest-book-2/src/main/resources/import.sql) content into [the v1](../rest-book/src/main/resources/import.sql) (don't forget to remove the existing lines).
Copy paste the [v2 ``import.sql.ORI``](../rest-book-2/src/main/resources/import.sql.ORI) content into [the v1](../rest-book/src/main/resources/import.sql.ORI) (don't forget to remove the existing lines).

### Tests

Expand Down
9 changes: 4 additions & 5 deletions infrastructure/db-init/initialize-databases.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CREATE ROLE bookstore WITH LOGIN PASSWORD 'bookstore';

CREATE ROLE book WITH LOGIN PASSWORD 'book' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
--CREATE ROLE bookstore WITH LOGIN PASSWORD 'bookstore';
--CREATE ROLE book WITH LOGIN PASSWORD 'book' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE DATABASE books_database;
GRANT ALL PRIVILEGES ON DATABASE books_database TO book ;
GRANT ALL PRIVILEGES ON DATABASE books_database TO bookstore;
--GRANT ALL PRIVILEGES ON DATABASE books_database TO book ;
--GRANT ALL PRIVILEGES ON DATABASE books_database TO bookstore;
5 changes: 4 additions & 1 deletion infrastructure/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
version: "3"
services:
database:
image: "postgres:12.1"
image: "postgres:16.1"
container_name: "books-database"
environment:
- POSTGRES_PASSWORD=book
- POSTGRES_USER=book
ports:
- "5432:5432"
volumes:
Expand Down
1 change: 0 additions & 1 deletion rest-book/src/main/resources/import.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
INSERT INTO Book(id, isbn_13, title, rank, small_image_url, medium_image_url, price, nb_of_pages, year_of_publication, author, description) VALUES ( 997, '9781980399025', 'Understanding Bean Validation', 9, 'https://images-na.ssl-images-amazon.com/images/I/31fHenHChZL._SL160_.jpg', 'https://images-na.ssl-images-amazon.com/images/I/31fHenHChZL.jpg', 9.99, 129, 2018, 'Antonio Goncalves', 'In this fascicle will you will learn Bean Validation and use its different APIs to apply constraints on a bean, validate all sorts of constraints and write your own constraints');

INSERT INTO Book(id, isbn_13, title, rank, small_image_url, medium_image_url, price, nb_of_pages, year_of_publication, author, description) VALUES ( 998, '9781093918977', 'Understanding JPA', 9, 'https://images-na.ssl-images-amazon.com/images/I/3122s2sjOtL._SL160_.jpg', 'https://images-na.ssl-images-amazon.com/images/I/3122s2sjOtL.jpg', 9.99, 246, 2019, 'Antonio Goncalves', 'In this fascicle, you will learn Java Persistence API, its annotations for mapping entities, as well as the Java Persistence Query Language and entity life cycle');
INSERT INTO Book(id, isbn_13, title, rank, small_image_url, medium_image_url, price, nb_of_pages, year_of_publication, author, description) VALUES ( 1001, '1931182310', 'Advanced Java EE Development for Rational Application Developer 7.5: Developers'' Guidebook', 2, 'http://ecx.images-amazon.com/images/I/51bjnhlGbeL._SL75_.jpg', 'http://ecx.images-amazon.com/images/I/51bjnhlGbeL._SL160_.jpg', 79.95, 752, 2011, 'Roger Kitain', 'Written by IBM senior field engineers and senior product development experts, this advanced book provides a solid look at the development of a range of core Java EE technologies, as well as an in-depth description of the development facilities provided by IBM Rational Application Developer version 7.5. Since the Java EE developmental platform incorporates a wide range of technologies from disparate and myriad sources, this up-to-date guidebook helps developers triumph over the complexity and depth of knowledge required to build successful architectures. Senior developers, engineers, and architects—especially those who work with Rational Application Developer and those seeking certification at the Sun-certified Java master-tier level or the IBM Rational Application Developer certified professional and certified advanced professional levels—will appreciate this convenient, single reference point.');
INSERT INTO Book(id, isbn_13, title, rank, small_image_url, medium_image_url, price, nb_of_pages, year_of_publication, author, description) VALUES ( 1002, '1931182311', 'Advanced Java EE Development for Rational Application Developer 7.5: Developers'' Guidebook Author: Robert McChesney Nov-2011', 3, 'http://ecx.images-amazon.com/images/I/51pri75YOPL._SL75_.jpg', 'http://ecx.images-amazon.com/images/I/51pri75YOPL._SL160_.jpg', 9.99, 543, 2011, 'Kinman Chung', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc');
Expand Down

0 comments on commit ae34d15

Please sign in to comment.