diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fde3cf2..0e68dda 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -12,11 +12,11 @@ spring: data-username: postgres password: qwer5795 username: postgres - # JPA properties + initialization-mode: never jpa: hibernate: - ddl-auto: create-drop + ddl-auto: update database: postgresql show-sql: true database-platform: org.hibernate.dialect.PostgreSQLDialect diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql new file mode 100644 index 0000000..bb6c9bb --- /dev/null +++ b/src/main/resources/data.sql @@ -0,0 +1,14 @@ +insert into public.tbl_user_group +(id ,title, description, is_default, register_date) +values +(1, '관리자', '관리자 그룹', false, '2019-07-20 12:00:30'); + +insert into public.tbl_user_group +(id ,title, description, is_default, register_date) +values +(2, '정회원', '정회원 그룹', true, '2019-07-20 12:00:30'); + +insert into public.tbl_user_group +(id ,title, description, is_default, register_date) +values +(3, '비회원', '비회원 그룹', false, '2019-07-20 12:00:30'); diff --git a/src/test/java/com/totopia/server/user/repository/UserRepositoryTest.java b/src/test/java/com/totopia/server/user/repository/UserRepositoryTest.java index a06e71c..691b0d1 100644 --- a/src/test/java/com/totopia/server/user/repository/UserRepositoryTest.java +++ b/src/test/java/com/totopia/server/user/repository/UserRepositoryTest.java @@ -38,13 +38,16 @@ public class UserRepositoryTest { @Test public void findByUsername() throws Exception { - User tempUser = user.build(); + User admin = this.userRepository.findByUsername("admin"); + if (admin == null) { + User tempUser = user.build(); - this.userRepository.save(tempUser); + this.userRepository.save(tempUser); - User user1 = this.userRepository.findByUsername(tempUser.getUsername()); + User user1 = this.userRepository.findByUsername(tempUser.getUsername()); - assertEquals("Equlas", user.build().getUsername(), user1.getUsername()); + assertEquals("Equlas", user.build().getUsername(), user1.getUsername()); + } } @Test