diff --git a/src/main/java/org/runimo/runimo/auth/controller/request/AuthSignupRequest.java b/src/main/java/org/runimo/runimo/auth/controller/request/AuthSignupRequest.java index aea52881..552e0535 100644 --- a/src/main/java/org/runimo/runimo/auth/controller/request/AuthSignupRequest.java +++ b/src/main/java/org/runimo/runimo/auth/controller/request/AuthSignupRequest.java @@ -4,6 +4,7 @@ import jakarta.validation.constraints.NotBlank; import org.hibernate.validator.constraints.URL; import org.runimo.runimo.auth.service.dtos.UserSignupCommand; +import org.runimo.runimo.user.domain.Gender; @Schema(description = "사용자 회원가입 요청 DTO") public record AuthSignupRequest( @@ -14,10 +15,13 @@ public record AuthSignupRequest( @NotBlank String nickname, @Schema(description = "프로필 이미지 URL", example = "https://example.com/image.jpg") - @URL String imgUrl + @URL String imgUrl, + + @Schema(description = "성별", example = "FEMALE") + Gender gender ) { public UserSignupCommand toUserSignupCommand() { - return new UserSignupCommand(registerToken, nickname, imgUrl); + return new UserSignupCommand(registerToken, nickname, imgUrl, gender); } } diff --git a/src/main/java/org/runimo/runimo/auth/service/SignUpUsecaseImpl.java b/src/main/java/org/runimo/runimo/auth/service/SignUpUsecaseImpl.java index cd850500..9ac4a11c 100644 --- a/src/main/java/org/runimo/runimo/auth/service/SignUpUsecaseImpl.java +++ b/src/main/java/org/runimo/runimo/auth/service/SignUpUsecaseImpl.java @@ -25,6 +25,7 @@ public SignupUserResponse register(UserSignupCommand command) { User savedUser = userRegisterService.registerUser(new UserRegisterCommand( command.nickname(), command.imgUrl(), + command.gender(), payload.providerId(), payload.socialProvider()) ); diff --git a/src/main/java/org/runimo/runimo/auth/service/dtos/UserSignupCommand.java b/src/main/java/org/runimo/runimo/auth/service/dtos/UserSignupCommand.java index 16d83a57..188ba389 100644 --- a/src/main/java/org/runimo/runimo/auth/service/dtos/UserSignupCommand.java +++ b/src/main/java/org/runimo/runimo/auth/service/dtos/UserSignupCommand.java @@ -1,10 +1,13 @@ package org.runimo.runimo.auth.service.dtos; +import org.runimo.runimo.user.domain.Gender; + public record UserSignupCommand( String registerToken, String nickname, - String imgUrl + String imgUrl, + Gender gender ) { } diff --git a/src/main/java/org/runimo/runimo/user/domain/Gender.java b/src/main/java/org/runimo/runimo/user/domain/Gender.java new file mode 100644 index 00000000..96603795 --- /dev/null +++ b/src/main/java/org/runimo/runimo/user/domain/Gender.java @@ -0,0 +1,5 @@ +package org.runimo.runimo.user.domain; + +public enum Gender { + MALE, FEMALE, UNKNOWN; +} diff --git a/src/main/java/org/runimo/runimo/user/domain/User.java b/src/main/java/org/runimo/runimo/user/domain/User.java index 49fe58d5..e3cc5c50 100644 --- a/src/main/java/org/runimo/runimo/user/domain/User.java +++ b/src/main/java/org/runimo/runimo/user/domain/User.java @@ -29,14 +29,17 @@ public class User extends BaseEntity { private Long totalTimeInSeconds = 0L; @Column(name = "main_runimo_id") private Long mainRunimoId; + @Column(name = "gender") + private Gender gender; @Builder public User(String nickname, String imgUrl, Long totalDistanceInMeters, - Long totalTimeInSeconds) { + Long totalTimeInSeconds, Gender gender) { this.nickname = nickname; this.imgUrl = imgUrl; this.totalDistanceInMeters = totalDistanceInMeters != null ? totalDistanceInMeters : 0L; this.totalTimeInSeconds = totalTimeInSeconds != null ? totalTimeInSeconds : 0L; + this.gender = gender; } public boolean checkUserFirstRun() { diff --git a/src/main/java/org/runimo/runimo/user/service/UserCreator.java b/src/main/java/org/runimo/runimo/user/service/UserCreator.java index 6d5a35eb..3e7f9cab 100644 --- a/src/main/java/org/runimo/runimo/user/service/UserCreator.java +++ b/src/main/java/org/runimo/runimo/user/service/UserCreator.java @@ -25,6 +25,7 @@ public User createUser(UserCreateCommand command) { User user = User.builder() .nickname(command.nickname()) .imgUrl(command.imgUrl()) + .gender(command.gender()) .build(); return userRepository.saveAndFlush(user); } diff --git a/src/main/java/org/runimo/runimo/user/service/UserRegisterService.java b/src/main/java/org/runimo/runimo/user/service/UserRegisterService.java index b8dd644e..6955d3f2 100644 --- a/src/main/java/org/runimo/runimo/user/service/UserRegisterService.java +++ b/src/main/java/org/runimo/runimo/user/service/UserRegisterService.java @@ -19,7 +19,7 @@ public class UserRegisterService { @Transactional public User registerUser(UserRegisterCommand command) { User savedUser = userCreator.createUser( - new UserCreateCommand(command.nickname(), command.imgUrl())); + new UserCreateCommand(command.nickname(), command.imgUrl(), command.gender())); userCreator.createUserOAuthInfo(savedUser, command.socialProvider(), command.providerId()); userCreator.createLovePoint(savedUser.getId()); userItemCreator.createAll(savedUser.getId()); diff --git a/src/main/java/org/runimo/runimo/user/service/dtos/UserCreateCommand.java b/src/main/java/org/runimo/runimo/user/service/dtos/UserCreateCommand.java index e596c237..0f1d64cd 100644 --- a/src/main/java/org/runimo/runimo/user/service/dtos/UserCreateCommand.java +++ b/src/main/java/org/runimo/runimo/user/service/dtos/UserCreateCommand.java @@ -1,8 +1,11 @@ package org.runimo.runimo.user.service.dtos; +import org.runimo.runimo.user.domain.Gender; + public record UserCreateCommand( String nickname, - String imgUrl + String imgUrl, + Gender gender ) { } diff --git a/src/main/java/org/runimo/runimo/user/service/dtos/UserRegisterCommand.java b/src/main/java/org/runimo/runimo/user/service/dtos/UserRegisterCommand.java index 61b67366..dd4676e4 100644 --- a/src/main/java/org/runimo/runimo/user/service/dtos/UserRegisterCommand.java +++ b/src/main/java/org/runimo/runimo/user/service/dtos/UserRegisterCommand.java @@ -1,10 +1,12 @@ package org.runimo.runimo.user.service.dtos; +import org.runimo.runimo.user.domain.Gender; import org.runimo.runimo.user.domain.SocialProvider; public record UserRegisterCommand( String nickname, String imgUrl, + Gender gender, String providerId, SocialProvider socialProvider ) { diff --git a/src/main/resources/sql/schema.sql b/src/main/resources/sql/schema.sql index b42633f7..2999986f 100644 --- a/src/main/resources/sql/schema.sql +++ b/src/main/resources/sql/schema.sql @@ -21,11 +21,12 @@ CREATE TABLE `users` `public_id` VARCHAR(255), `nickname` VARCHAR(255), `img_url` VARCHAR(255), - `total_distance_in_meters` BIGINT NOT NULL DEFAULT 0, - `total_time_in_seconds` BIGINT NOT NULL DEFAULT 0, + `total_distance_in_meters` BIGINT NOT NULL DEFAULT 0, + `total_time_in_seconds` BIGINT NOT NULL DEFAULT 0, `main_runimo_id` BIGINT, - `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `gender` VARCHAR(24), + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `deleted_at` TIMESTAMP NULL ); @@ -35,25 +36,25 @@ CREATE TABLE `user_token` `device_token` VARCHAR(255) NOT NULL, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL, + `deleted_at` TIMESTAMP NULL, FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ); CREATE TABLE `user_love_point` ( - `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` BIGINT NOT NULL, - `amount` BIGINT NOT NULL DEFAULT 0, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `id` BIGINT PRIMARY KEY AUTO_INCREMENT, + `user_id` BIGINT NOT NULL, + `amount` BIGINT NOT NULL DEFAULT 0, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `deleted_at` TIMESTAMP NULL ); CREATE TABLE `oauth_account` ( `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` BIGINT NOT NULL, + `user_id` BIGINT NOT NULL, `provider` VARCHAR(255), `provider_id` VARCHAR(255), `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -65,7 +66,7 @@ CREATE TABLE `oauth_account` CREATE TABLE `running_record` ( `id` INTEGER PRIMARY KEY AUTO_INCREMENT, - `user_id` INTEGER NOT NULL, + `user_id` INTEGER NOT NULL, `record_public_id` VARCHAR(255) NOT NULL, `title` VARCHAR(255), `started_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -76,7 +77,7 @@ CREATE TABLE `running_record` `pace_per_km` VARCHAR(10000), `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `deleted_at` TIMESTAMP NULL ); CREATE TABLE `item` @@ -92,27 +93,27 @@ CREATE TABLE `item` `hatch_require_amount` BIGINT, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `deleted_at` TIMESTAMP NULL ); CREATE TABLE `item_activity` ( `id` INTEGER PRIMARY KEY AUTO_INCREMENT, - `activity_user_id` INTEGER NOT NULL, - `activity_item_id` INTEGER NOT NULL, + `activity_user_id` INTEGER NOT NULL, + `activity_item_id` INTEGER NOT NULL, `activity_event_type` VARCHAR(255) NOT NULL, `quantity` INTEGER, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `deleted_at` TIMESTAMP NULL ); CREATE TABLE `user_item` ( `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` INTEGER NOT NULL, - `item_id` INTEGER NOT NULL, - `quantity` INTEGER NOT NULL, + `user_id` INTEGER NOT NULL, + `item_id` INTEGER NOT NULL, + `quantity` INTEGER NOT NULL, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `deleted_at` TIMESTAMP NULL @@ -121,8 +122,8 @@ CREATE TABLE `user_item` CREATE TABLE `incubating_egg` ( `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` INTEGER NOT NULL, - `egg_id` INTEGER NOT NULL, + `user_id` INTEGER NOT NULL, + `egg_id` INTEGER NOT NULL, `current_love_point_amount` INTEGER, `hatch_require_amount` INTEGER, `egg_status` VARCHAR(255), @@ -133,27 +134,27 @@ CREATE TABLE `incubating_egg` CREATE TABLE `runimo_definition` ( - `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `name` VARCHAR(255), - `code` VARCHAR(255), - `description` VARCHAR(255), - `img_url` varchar(255), - `egg_type` varchar(255) NOT NULL, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `id` BIGINT PRIMARY KEY AUTO_INCREMENT, + `name` VARCHAR(255), + `code` VARCHAR(255), + `description` VARCHAR(255), + `img_url` varchar(255), + `egg_type` varchar(255) NOT NULL, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` TIMESTAMP NULL ); CREATE TABLE `runimo` ( - `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` BIGINT NOT NULL, - `runimo_definition_id` BIGINT NOT NULL, - `total_run_count` BIGINT NOT NULL DEFAULT 0, - `total_distance_in_meters` BIGINT NOT NULL DEFAULT 0, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `id` BIGINT PRIMARY KEY AUTO_INCREMENT, + `user_id` BIGINT NOT NULL, + `runimo_definition_id` BIGINT NOT NULL, + `total_run_count` BIGINT NOT NULL DEFAULT 0, + `total_distance_in_meters` BIGINT NOT NULL DEFAULT 0, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` TIMESTAMP NULL ); ALTER TABLE `user_token` diff --git a/src/test/java/org/runimo/runimo/rewards/RewardTest.java b/src/test/java/org/runimo/runimo/rewards/RewardTest.java index fe64da8a..26d2f263 100644 --- a/src/test/java/org/runimo/runimo/rewards/RewardTest.java +++ b/src/test/java/org/runimo/runimo/rewards/RewardTest.java @@ -20,6 +20,7 @@ import org.runimo.runimo.rewards.service.RewardService; import org.runimo.runimo.rewards.service.dtos.RewardClaimCommand; import org.runimo.runimo.rewards.service.dtos.RewardResponse; +import org.runimo.runimo.user.domain.Gender; import org.runimo.runimo.user.domain.SocialProvider; import org.runimo.runimo.user.domain.User; import org.runimo.runimo.user.domain.UserItem; @@ -57,7 +58,7 @@ void setUp() { //given String registerToken = jwtTokenFactory.generateRegisterTemporalToken("test-pid", SocialProvider.KAKAO); - UserSignupCommand command = new UserSignupCommand(registerToken, "name", "1234"); + UserSignupCommand command = new UserSignupCommand(registerToken, "name", "1234", Gender.UNKNOWN); Long useId = signUpUsecaseImpl.register(command).userId(); savedUser = userRepository.findById(useId).orElse(null); } diff --git a/src/test/java/org/runimo/runimo/user/api/UserItemAcceptanceTest.java b/src/test/java/org/runimo/runimo/user/api/UserItemAcceptanceTest.java index b792d6a8..75236347 100644 --- a/src/test/java/org/runimo/runimo/user/api/UserItemAcceptanceTest.java +++ b/src/test/java/org/runimo/runimo/user/api/UserItemAcceptanceTest.java @@ -25,6 +25,7 @@ import org.runimo.runimo.auth.service.dtos.SignupUserResponse; import org.runimo.runimo.auth.service.dtos.TokenPair; import org.runimo.runimo.user.controller.request.UseItemRequest; +import org.runimo.runimo.user.domain.Gender; import org.runimo.runimo.user.domain.SocialProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -148,7 +149,8 @@ void tearDown() { AuthSignupRequest request = new AuthSignupRequest( registerToken, "test-user", - "https://test-image.com" + "https://test-image.com", + Gender.FEMALE ); ValidatableResponse res = given() diff --git a/src/test/java/org/runimo/runimo/user/service/usecases/UserRegisterServiceTest.java b/src/test/java/org/runimo/runimo/user/service/usecases/UserRegisterServiceTest.java index 8565b851..84aed928 100644 --- a/src/test/java/org/runimo/runimo/user/service/usecases/UserRegisterServiceTest.java +++ b/src/test/java/org/runimo/runimo/user/service/usecases/UserRegisterServiceTest.java @@ -14,6 +14,7 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.runimo.runimo.rewards.service.eggs.EggGrantService; +import org.runimo.runimo.user.domain.Gender; import org.runimo.runimo.user.domain.SocialProvider; import org.runimo.runimo.user.domain.User; import org.runimo.runimo.user.service.UserCreator; @@ -48,6 +49,7 @@ void setUp() { new UserRegisterCommand( "test-nickname", "https://test.com", + Gender.UNKNOWN, providerId, SocialProvider.KAKAO ); diff --git a/src/test/resources/sql/schema.sql b/src/test/resources/sql/schema.sql index 6cb6f898..06bdd28d 100644 --- a/src/test/resources/sql/schema.sql +++ b/src/test/resources/sql/schema.sql @@ -21,11 +21,12 @@ CREATE TABLE `users` `public_id` VARCHAR(255), `nickname` VARCHAR(255), `img_url` VARCHAR(255), - `total_distance_in_meters` BIGINT NOT NULL DEFAULT 0, - `total_time_in_seconds` BIGINT NOT NULL DEFAULT 0, + `total_distance_in_meters` BIGINT NOT NULL DEFAULT 0, + `total_time_in_seconds` BIGINT NOT NULL DEFAULT 0, `main_runimo_id` BIGINT, - `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `gender` VARCHAR(24), + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `deleted_at` TIMESTAMP NULL ); @@ -35,25 +36,25 @@ CREATE TABLE `user_token` `device_token` VARCHAR(255) NOT NULL, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL, + `deleted_at` TIMESTAMP NULL, FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ); CREATE TABLE `user_love_point` ( - `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` BIGINT NOT NULL, - `amount` BIGINT NOT NULL DEFAULT 0, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `id` BIGINT PRIMARY KEY AUTO_INCREMENT, + `user_id` BIGINT NOT NULL, + `amount` BIGINT NOT NULL DEFAULT 0, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `deleted_at` TIMESTAMP NULL ); CREATE TABLE `oauth_account` ( `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` BIGINT NOT NULL, + `user_id` BIGINT NOT NULL, `provider` VARCHAR(255), `provider_id` VARCHAR(255), `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -66,7 +67,7 @@ CREATE TABLE `oauth_account` CREATE TABLE `running_record` ( `id` INTEGER PRIMARY KEY AUTO_INCREMENT, - `user_id` INTEGER NOT NULL, + `user_id` INTEGER NOT NULL, `record_public_id` VARCHAR(255) NOT NULL, `title` VARCHAR(255), `started_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -77,7 +78,7 @@ CREATE TABLE `running_record` `pace_per_km` VARCHAR(10000), `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `deleted_at` TIMESTAMP NULL ); CREATE TABLE `item` @@ -93,27 +94,27 @@ CREATE TABLE `item` `hatch_require_amount` BIGINT, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `deleted_at` TIMESTAMP NULL ); CREATE TABLE `item_activity` ( `id` INTEGER PRIMARY KEY AUTO_INCREMENT, - `activity_user_id` INTEGER NOT NULL, - `activity_item_id` INTEGER NOT NULL, + `activity_user_id` INTEGER NOT NULL, + `activity_item_id` INTEGER NOT NULL, `activity_event_type` VARCHAR(255) NOT NULL, `quantity` INTEGER, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `deleted_at` TIMESTAMP NULL ); CREATE TABLE `user_item` ( `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` INTEGER NOT NULL, - `item_id` INTEGER NOT NULL, - `quantity` INTEGER NOT NULL, + `user_id` INTEGER NOT NULL, + `item_id` INTEGER NOT NULL, + `quantity` INTEGER NOT NULL, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `deleted_at` TIMESTAMP NULL @@ -122,8 +123,8 @@ CREATE TABLE `user_item` CREATE TABLE `incubating_egg` ( `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` INTEGER NOT NULL, - `egg_id` INTEGER NOT NULL, + `user_id` INTEGER NOT NULL, + `egg_id` INTEGER NOT NULL, `current_love_point_amount` INTEGER, `hatch_require_amount` INTEGER, `egg_status` VARCHAR(255), @@ -134,27 +135,27 @@ CREATE TABLE `incubating_egg` CREATE TABLE `runimo_definition` ( - `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `name` VARCHAR(255), - `code` VARCHAR(255), - `description` VARCHAR(255), - `img_url` varchar(255), - `egg_type` varchar(255) NOT NULL, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `id` BIGINT PRIMARY KEY AUTO_INCREMENT, + `name` VARCHAR(255), + `code` VARCHAR(255), + `description` VARCHAR(255), + `img_url` varchar(255), + `egg_type` varchar(255) NOT NULL, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` TIMESTAMP NULL ); CREATE TABLE `runimo` ( - `id` BIGINT PRIMARY KEY AUTO_INCREMENT, - `user_id` BIGINT NOT NULL, - `runimo_definition_id` BIGINT NOT NULL, - `total_run_count` BIGINT NOT NULL DEFAULT 0, - `total_distance_in_meters` BIGINT NOT NULL DEFAULT 0, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted_at` TIMESTAMP NULL + `id` BIGINT PRIMARY KEY AUTO_INCREMENT, + `user_id` BIGINT NOT NULL, + `runimo_definition_id` BIGINT NOT NULL, + `total_run_count` BIGINT NOT NULL DEFAULT 0, + `total_distance_in_meters` BIGINT NOT NULL DEFAULT 0, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` TIMESTAMP NULL ); ALTER TABLE `user_token`