Skip to content

Commit 6013141

Browse files
committed
Should work
1 parent 0cc178e commit 6013141

8 files changed

Lines changed: 110 additions & 176 deletions

pom.xml

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,45 +32,33 @@
3232
<dependencies>
3333
<dependency>
3434
<groupId>org.springframework.boot</groupId>
35-
<artifactId>spring-boot-starter-graphql</artifactId>
35+
<artifactId>spring-boot-starter-jdbc</artifactId>
3636
</dependency>
3737
<dependency>
38-
<groupId>org.springframework.boot</groupId>
39-
<artifactId>spring-boot-starter-webmvc</artifactId>
38+
<groupId>org.projectlombok</groupId>
39+
<artifactId>lombok</artifactId>
40+
<scope>provided</scope>
4041
</dependency>
4142
<dependency>
4243
<groupId>org.springframework.boot</groupId>
43-
<artifactId>spring-boot-starter-data-jpa</artifactId>
44-
</dependency>
45-
<dependency>
46-
<groupId>org.postgresql</groupId>
47-
<artifactId>postgresql</artifactId>
48-
<scope>runtime</scope>
49-
</dependency>
50-
<dependency>
51-
<groupId>org.liquibase</groupId>
52-
<artifactId>liquibase-core</artifactId>
44+
<artifactId>spring-boot-starter-webmvc</artifactId>
5345
</dependency>
54-
5546
<dependency>
56-
<groupId>org.projectlombok</groupId>
57-
<artifactId>lombok</artifactId>
58-
<optional>true</optional>
47+
<groupId>org.springframework.boot</groupId>
48+
<artifactId>spring-boot-starter-liquibase</artifactId>
5949
</dependency>
6050
<dependency>
6151
<groupId>org.springframework.boot</groupId>
62-
<artifactId>spring-boot-starter-graphql-test</artifactId>
63-
<scope>test</scope>
52+
<artifactId>spring-boot-starter-data-jpa</artifactId>
6453
</dependency>
6554
<dependency>
6655
<groupId>org.springframework.boot</groupId>
67-
<artifactId>spring-boot-starter-webmvc-test</artifactId>
68-
<scope>test</scope>
56+
<artifactId>spring-boot-starter-test</artifactId>
6957
</dependency>
7058
<dependency>
71-
<groupId>org.projectlombok</groupId>
72-
<artifactId>lombok</artifactId>
73-
<scope>provided</scope>
59+
<groupId>org.postgresql</groupId>
60+
<artifactId>postgresql</artifactId>
61+
<scope>runtime</scope>
7462
</dependency>
7563
</dependencies>
7664

@@ -100,21 +88,6 @@
10088
</excludes>
10189
</configuration>
10290
</plugin>
103-
<plugin>
104-
<groupId>org.liquibase</groupId>
105-
<artifactId>liquibase-maven-plugin</artifactId>
106-
<configuration>
107-
<propertyFile>src/main/resources/application.properties</propertyFile>
108-
<changeLogFile>src/main/resources/db/changelog/db.changelog-master.yaml</changeLogFile>
109-
</configuration>
110-
<dependencies>
111-
<dependency>
112-
<groupId>org.postgresql</groupId>
113-
<artifactId>postgresql</artifactId>
114-
<version>${postgresql.version}</version>
115-
</dependency>
116-
</dependencies>
117-
</plugin>
11891
</plugins>
11992
</build>
12093

src/main/resources/application.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
1313
spring.jpa.properties.hibernate.format_sql=true
1414

1515
# Liquibase Configuration
16-
spring.liquibase.change-log=classpath:db/changelog/db.changelog-master.yaml
1716
spring.liquibase.enabled=true
18-
spring.liquibase.drop-first=false
17+
spring.liquibase.change-log=classpath:db/changelog/db.changelog-master.xml
1918

2019
# Logging
21-
logging.level.liquibase=INFO
20+
logging.level.liquibase=info
2221
logging.level.org.hibernate=INFO
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">
7+
8+
<changeSet id="001-create-products-table" author="performance-poc">
9+
<createTable tableName="products">
10+
<column name="id" type="BIGSERIAL">
11+
<constraints primaryKey="true" nullable="false"/>
12+
</column>
13+
<column name="name" type="VARCHAR(255)">
14+
<constraints nullable="false"/>
15+
</column>
16+
<column name="description" type="TEXT"/>
17+
<column name="price" type="DECIMAL(19,2)">
18+
<constraints nullable="false"/>
19+
</column>
20+
<column name="quantity" type="INTEGER">
21+
<constraints nullable="false"/>
22+
</column>
23+
<column name="created_at" type="TIMESTAMP">
24+
<constraints nullable="false"/>
25+
</column>
26+
<column name="updated_at" type="TIMESTAMP">
27+
<constraints nullable="false"/>
28+
</column>
29+
</createTable>
30+
31+
<createIndex indexName="idx_products_name" tableName="products">
32+
<column name="name"/>
33+
</createIndex>
34+
35+
<rollback>
36+
<dropIndex indexName="idx_products_name" tableName="products"/>
37+
<dropTable tableName="products"/>
38+
</rollback>
39+
</changeSet>
40+
41+
</databaseChangeLog>

src/main/resources/db/changelog/changes/001-create-products-table.yaml

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">
7+
8+
<changeSet id="002-insert-sample-products" author="performance-poc">
9+
<insert tableName="products">
10+
<column name="name" value="Laptop"/>
11+
<column name="description" value="High-performance laptop for developers"/>
12+
<column name="price" valueNumeric="1299.99"/>
13+
<column name="quantity" valueNumeric="10"/>
14+
<column name="created_at" valueDate="now()"/>
15+
<column name="updated_at" valueDate="now()"/>
16+
</insert>
17+
18+
<insert tableName="products">
19+
<column name="name" value="Wireless Mouse"/>
20+
<column name="description" value="Ergonomic wireless mouse"/>
21+
<column name="price" valueNumeric="29.99"/>
22+
<column name="quantity" valueNumeric="50"/>
23+
<column name="created_at" valueDate="now()"/>
24+
<column name="updated_at" valueDate="now()"/>
25+
</insert>
26+
27+
<insert tableName="products">
28+
<column name="name" value="Mechanical Keyboard"/>
29+
<column name="description" value="RGB mechanical keyboard with blue switches"/>
30+
<column name="price" valueNumeric="149.99"/>
31+
<column name="quantity" valueNumeric="25"/>
32+
<column name="created_at" valueDate="now()"/>
33+
<column name="updated_at" valueDate="now()"/>
34+
</insert>
35+
36+
<rollback>
37+
<delete tableName="products">
38+
<where>name IN ('Laptop', 'Wireless Mouse', 'Mechanical Keyboard')</where>
39+
</delete>
40+
</rollback>
41+
</changeSet>
42+
43+
</databaseChangeLog>
44+

src/main/resources/db/changelog/changes/002-insert-sample-products.yaml

Lines changed: 0 additions & 73 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">
7+
8+
<include file="db/changelog/changes/001-create-products-table.xml"/>
9+
<include file="db/changelog/changes/002-insert-sample-products.xml"/>
10+
11+
</databaseChangeLog>

src/main/resources/db/changelog/db.changelog-master.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)