You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "joyCurry30 (via GitHub)" <gi...@apache.org> on 2024/02/26 03:44:52 UTC
[PR] [BUG] Use @TableField to replace the SQL syntax ON UPDATE CURRENT_TIMESTAMP. [incubator-streampark]
joyCurry30 opened a new pull request, #3572:
URL: https://github.com/apache/incubator-streampark/pull/3572
<!--
Thank you for contributing to StreamPark! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
## Contribution Checklist
- If this is your first time, please read our contributor guidelines: [Submit Code](https://streampark.apache.org/community/submit_guide/submit_code).
- Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-streampark/issues).
- Name the pull request in the form "[Feature] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- If the PR is unfinished, add `[WIP]` in your PR title, e.g., `[WIP][Feature] Title of the pull request`.
-->
## What changes were proposed in this pull request
Issue Number: close #3570 <!-- REMOVE this line if no issue to close -->
<!--(For example: This pull request proposed to add checkstyle plugin).-->
Use @TableField to replace the SQL syntax ON UPDATE CURRENT_TIMESTAMP.
## Brief change log
<!--*(for example:)*
- *Add maven-checkstyle-plugin to root pom.xml*
-->
## Verifying this change
<!--*(Please pick either of the following options)*-->
This change is a trivial rework / code cleanup without any test coverage.
*(or)*
This change is already covered by existing tests, such as *(please describe tests)*.
*(or)*
This change added tests and can be verified as follows:
<!--*(example:)*
- *Added integration tests for end-to-end.*
- *Added *Test to verify the change.*
- *Manually verified the change by testing locally.* -->
## Does this pull request potentially affect one of the following parts
- Dependencies (does it add or upgrade a dependency): (yes / no) no
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [BUG] Use @TableField to replace the SQL syntax ON UPDATE CURRENT_TIMESTAMP. [incubator-streampark]
Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys commented on code in PR #3572:
URL: https://github.com/apache/incubator-streampark/pull/3572#discussion_r1502100734
##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java:
##########
@@ -70,8 +72,10 @@ public class User implements Serializable {
@NotBlank(message = "{required}")
private String status;
+ @TableField(fill = FieldFill.INSERT)
private Date createTime;
+ @TableField(update = "now()", fill = FieldFill.INSERT_UPDATE)
Review Comment:
It is not advisable to use annotations. This will trigger an update whenever there is a change in the records in the table, which does not meet our expectations. The `modifyTime` is only updated when users manually modify entity info on the frontend. Often, StremaPark will modify records in the table, e.g: When the system detects a change in the job status. that needs to be synchronized to the database. In these cases, we do not want to update the `modifyTime`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improve] mysql and postgre ddl current_timestamp syntax compatibility improvement. [incubator-streampark]
Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys merged PR #3572:
URL: https://github.com/apache/incubator-streampark/pull/3572
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [BUG] Use @TableField to replace the SQL syntax ON UPDATE CURRENT_TIMESTAMP. [incubator-streampark]
Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys commented on code in PR #3572:
URL: https://github.com/apache/incubator-streampark/pull/3572#discussion_r1502102732
##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java:
##########
@@ -70,8 +72,10 @@ public class User implements Serializable {
@NotBlank(message = "{required}")
private String status;
+ @TableField(fill = FieldFill.INSERT)
Review Comment:
It is suggested to manually set the value when new entity to be save.
##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java:
##########
@@ -70,8 +72,10 @@ public class User implements Serializable {
@NotBlank(message = "{required}")
private String status;
+ @TableField(fill = FieldFill.INSERT)
private Date createTime;
+ @TableField(update = "now()", fill = FieldFill.INSERT_UPDATE)
Review Comment:
It is not advisable to use annotations. This will trigger an update whenever there is a change in the records in the table, which does not meet our expectations. The `modifyTime` is only updated when users manually modify entity info on the frontend. Often, StremaPark will modify records in the table, e.g: When the system detects a change in the job status. that needs to be synchronized to the database. In these cases, we do not want to update the `modifyTime`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [BUG] Use @TableField to replace the SQL syntax ON UPDATE CURRENT_TIMESTAMP. [incubator-streampark]
Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys commented on code in PR #3572:
URL: https://github.com/apache/incubator-streampark/pull/3572#discussion_r1502103508
##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java:
##########
@@ -202,10 +203,12 @@ public class Application implements Serializable {
private String description;
+ @TableField(fill = FieldFill.INSERT)
private Date createTime;
private Date optionTime;
+ @TableField(update = "now()", fill = FieldFill.INSERT_UPDATE)
private Date modifyTime;
Review Comment:
It is not advisable to use annotations. This will trigger an update whenever there is a change in the records in the table, which does not meet our expectations. The `modifyTime` is only updated when users manually modify entity info on the frontend. Often, StremaPark will modify records in the table, e.g: When the system detects a change in the job status. that needs to be synchronized to the database. In these cases, we do not want to update the `modifyTime`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org