Skip to content

Commit 48f4e05

Browse files
committed
refactor: criação do esquema de dados postgres #64
1 parent c59c580 commit 48f4e05

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@
9797
<optional>true</optional>
9898
</dependency>
9999

100+
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
100101
<dependency>
101-
<groupId>mysql</groupId>
102-
<artifactId>mysql-connector-java</artifactId>
103-
<version>[8.0.16,)</version>
104-
<scope>runtime</scope>
102+
<groupId>org.postgresql</groupId>
103+
<artifactId>postgresql</artifactId>
104+
<version>42.5.0</version>
105105
</dependency>
106106
<dependency>
107107
<groupId>org.springframework.boot</groupId>
@@ -262,7 +262,7 @@
262262
<configuration>
263263
<dependencyDetailsEnabled>true</dependencyDetailsEnabled>
264264
</configuration>
265-
<!-- <reportSets> <reportSet> <reports> <report>dependencies</report>
265+
<!-- <reportSets> <reportSet> <reports> <report>dependencies</report>
266266
<report>scm</report> </reports> </reportSet> </reportSets> -->
267267
</plugin>
268268
<plugin>

src/main/java/br/ufrn/dct/apf/repository/ProjectRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
@Repository("projectRepository")
1313
public interface ProjectRepository extends JpaRepository<Project, Long> {
1414

15-
@Query(value = "SELECT * FROM project p, member m where p.project_id = m.project_id and m.user_id = :userId", nativeQuery=true)
15+
@Query(value = "SELECT * FROM apf.project p, apf.member m where p.project_id = m.project_id and m.user_id = :userId", nativeQuery=true)
1616
List<Project> findByUserId(@Param("userId") Long userId);
1717

1818
List<Project> findByNameContaining(String name);
1919

2020
List<Project> findByTeamUserIdAndNameContaining(Long userId, String name);
21-
21+
2222
List<Project> findByIsPrivateFalse();
2323

2424
}

src/main/resources/application.properties

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
# ===============================
22
# = DATA SOURCE
33
# ===============================
4-
spring.datasource.url = jdbc:mysql://localhost:3306/apf_db
5-
spring.datasource.username = apf_user
6-
spring.datasource.password = 12345
7-
spring.datasource.testWhileIdle = true
8-
spring.datasource.validationQuery = SELECT 1
9-
spring.datasource.driverclassname = com.mysql.cj.jdbc.Driver
4+
spring.datasource.url=jdbc:postgresql://localhost:5432/apf_db
5+
spring.datasource.username=apf_user
6+
spring.datasource.password=12345
7+
spring.datasource.testWhileIdle=true
8+
spring.datasource.validationQuery=SELECT 1
9+
spring.datasource.driverclassname=org.postgresql.Driver
10+
spring.datasource.continueOnError=true
1011

1112
# ===============================
1213
# = JPA / HIBERNATE
1314
# ===============================
14-
#spring.jpa.show-sql = true
15+
spring.jpa.properties.hibernate.default_schema=apf
16+
spring.jpa.show-sql=true
1517
#spring.jpa.properties.hibernate.format_sql=true
16-
spring.jpa.hibernate.ddl-auto = update
17-
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
18-
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
18+
spring.jpa.hibernate.ddl-auto=update
19+
#spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
20+
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
21+
spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
22+
23+
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
24+
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
1925

2026
logging.level.br.ufrn.dct.apf=DEBUG
2127
#logging.level.org.hibernate.SQL=DEBUG
@@ -41,8 +47,8 @@ server.port=8080
4147
# ==============================================================
4248
# = Spring Security / Queries for AuthenticationManagerBuilder
4349
# ==============================================================
44-
spring.queries.users-query=select email, password, active from user where email=?
45-
spring.queries.roles-query=select u.email, r.role_name from user u inner join user_role ur on(u.user_id=ur.user_id) inner join role r on(ur.role_id=r.role_id) where u.email=?
50+
spring.queries.users-query=select email, password, active from apf.user where email=?
51+
spring.queries.roles-query=select u.email, r.role_name from apf.user u inner join apf.user_role ur on(u.user_id=ur.user_id) inner join apf.role r on(ur.role_id=r.role_id) where u.email=?
4652

4753
# =============================================================
4854
# = Spring General

0 commit comments

Comments
 (0)