Skip to content

Commit

Permalink
refactor: criação do esquema de dados postgres #64
Browse files Browse the repository at this point in the history
  • Loading branch information
tacianosilva committed Oct 4, 2022
1 parent c59c580 commit 48f4e05
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@
<optional>true</optional>
</dependency>

<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>[8.0.16,)</version>
<scope>runtime</scope>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -262,7 +262,7 @@
<configuration>
<dependencyDetailsEnabled>true</dependencyDetailsEnabled>
</configuration>
<!-- <reportSets> <reportSet> <reports> <report>dependencies</report>
<!-- <reportSets> <reportSet> <reports> <report>dependencies</report>
<report>scm</report> </reports> </reportSet> </reportSets> -->
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
@Repository("projectRepository")
public interface ProjectRepository extends JpaRepository<Project, Long> {

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

List<Project> findByNameContaining(String name);

List<Project> findByTeamUserIdAndNameContaining(Long userId, String name);

List<Project> findByIsPrivateFalse();

}
30 changes: 18 additions & 12 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
# ===============================
# = DATA SOURCE
# ===============================
spring.datasource.url = jdbc:mysql://localhost:3306/apf_db
spring.datasource.username = apf_user
spring.datasource.password = 12345
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
spring.datasource.driverclassname = com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/apf_db
spring.datasource.username=apf_user
spring.datasource.password=12345
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
spring.datasource.driverclassname=org.postgresql.Driver
spring.datasource.continueOnError=true

# ===============================
# = JPA / HIBERNATE
# ===============================
#spring.jpa.show-sql = true
spring.jpa.properties.hibernate.default_schema=apf
spring.jpa.show-sql=true
#spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.ddl-auto = update
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

logging.level.br.ufrn.dct.apf=DEBUG
#logging.level.org.hibernate.SQL=DEBUG
Expand All @@ -41,8 +47,8 @@ server.port=8080
# ==============================================================
# = Spring Security / Queries for AuthenticationManagerBuilder
# ==============================================================
spring.queries.users-query=select email, password, active from user where email=?
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=?
spring.queries.users-query=select email, password, active from apf.user where email=?
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=?

# =============================================================
# = Spring General
Expand Down

0 comments on commit 48f4e05

Please sign in to comment.