Skip to content

Commit

Permalink
0005188: back out utc create_time for now
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Jun 28, 2022
1 parent 8e958e8 commit b3d03fe
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
Expand Up @@ -65,9 +65,4 @@ private String buildColumnsAreNotEqualString(Table table, String table1Name, Str
}
return builder.toString();
}

@Override
protected String getCreateTimeExpression() {
return "getutcdate()";
}
}
Expand Up @@ -60,7 +60,7 @@ public MySqlTriggerTemplate(ISymmetricDialect symmetricDialect, boolean isConver
" ), \n" +
" $(channelExpression), $(txIdExpression), @sync_node_disabled, \n" +
" $(externalSelect), \n" +
" UTC_TIMESTAMP() \n" +
" CURRENT_TIMESTAMP \n" +
" ); \n" +
" end if; \n" +
" $(custom_on_insert_text) \n" +
Expand All @@ -79,7 +79,7 @@ public MySqlTriggerTemplate(ISymmetricDialect symmetricDialect, boolean isConver
" concat($(newKeys)), \n" +
" $(channelExpression), $(txIdExpression), @sync_node_disabled, \n" +
" $(externalSelect), \n" +
" UTC_TIMESTAMP() \n" +
" CURRENT_TIMESTAMP \n" +
" ); \n" +
" end if; \n" +
" $(custom_on_insert_text) \n" +
Expand All @@ -106,7 +106,7 @@ public MySqlTriggerTemplate(ISymmetricDialect symmetricDialect, boolean isConver
" var_old_data, \n" +
" $(channelExpression), $(txIdExpression), @sync_node_disabled, \n" +
" $(externalSelect), \n" +
" UTC_TIMESTAMP() \n" +
" CURRENT_TIMESTAMP \n" +
" ); \n" +
" end if; \n" +
" end if; \n" +
Expand All @@ -128,7 +128,7 @@ public MySqlTriggerTemplate(ISymmetricDialect symmetricDialect, boolean isConver
" ), \n" +
" $(channelExpression), $(txIdExpression), @sync_node_disabled, \n" +
" $(externalSelect), \n" +
" UTC_TIMESTAMP() \n" +
" CURRENT_TIMESTAMP \n" +
" ); \n" +
" end if; \n" +
" end if; \n" +
Expand All @@ -151,7 +151,7 @@ public MySqlTriggerTemplate(ISymmetricDialect symmetricDialect, boolean isConver
" ), \n" +
" $(channelExpression), $(txIdExpression), @sync_node_disabled, \n" +
" $(externalSelect), \n" +
" UTC_TIMESTAMP() \n" +
" CURRENT_TIMESTAMP \n" +
" ); \n" +
" end if; \n" +
" $(custom_on_delete_text) \n" +
Expand Down
Expand Up @@ -262,7 +262,7 @@ protected final String getNumberConversionString() {
protected final String getCreateTimeExpression(ISymmetricDialect symmetricDialect) {
String timezone = symmetricDialect.getParameterService().getString(ParameterConstants.DATA_CREATE_TIME_TIMEZONE);
if (StringUtils.isEmpty(timezone)) {
return "CURRENT_TIMESTAMP AT TIME ZONE '0:0'";
return "CURRENT_TIMESTAMP";
} else {
return String.format("CURRENT_TIMESTAMP AT TIME ZONE '%s'", timezone);
}
Expand Down
Expand Up @@ -231,7 +231,7 @@ protected boolean requiresWrappedBlobTemplateForBlobType() {
protected final String getCreateTimeExpression(ISymmetricDialect symmetricDialect) {
String timezone = symmetricDialect.getParameterService().getString(ParameterConstants.DATA_CREATE_TIME_TIMEZONE);
if (StringUtils.isEmpty(timezone)) {
return "CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
return "CURRENT_TIMESTAMP";
} else {
return String.format("CURRENT_TIMESTAMP AT TIME ZONE '%s'", timezone);
}
Expand Down
Expand Up @@ -68,7 +68,7 @@ public SqliteTriggerTemplate(AbstractSymmetricDialect symmetricDialect) {
+ " values( \n" + " '$(targetTableName)', \n" + " 'I', \n"
+ " $(triggerHistoryId), \n"
+ " $(columns), \n" + " $(channelExpression), null," + sourceNodeExpression + ", \n"
+ " $(externalSelect), \n" + " strftime('%Y-%m-%d %H:%M:%f','now') \n" + " ); \n"
+ " $(externalSelect), \n" + " strftime('%Y-%m-%d %H:%M:%f','now','localtime') \n" + " ); \n"
+ " $(custom_on_insert_text) \n"
+ "end");
sqlTemplates
Expand All @@ -81,7 +81,7 @@ public SqliteTriggerTemplate(AbstractSymmetricDialect symmetricDialect) {
+ " values( \n" + " '$(targetTableName)', \n" + " 'R', \n"
+ " $(triggerHistoryId), \n"
+ " $(newKeys), \n" + " $(channelExpression), null," + sourceNodeExpression + ", \n"
+ " $(externalSelect), \n" + " strftime('%Y-%m-%d %H:%M:%f','now') \n" + " ); \n"
+ " $(externalSelect), \n" + " strftime('%Y-%m-%d %H:%M:%f','now','localtime') \n" + " ); \n"
+ " $(custom_on_insert_text) \n"
+ "end");
sqlTemplates
Expand All @@ -95,7 +95,7 @@ public SqliteTriggerTemplate(AbstractSymmetricDialect symmetricDialect) {
+ " $(triggerHistoryId), \n" + " $(oldKeys), \n"
+ " $(columns), \n" + " $(oldColumns), \n"
+ " $(channelExpression), null," + sourceNodeExpression + ", \n" + " $(externalSelect), \n"
+ " strftime('%Y-%m-%d %H:%M:%f','now') \n" + " ); \n"
+ " strftime('%Y-%m-%d %H:%M:%f','now','localtime') \n" + " ); \n"
+ " $(custom_on_update_text) \n"
+ "end ");
sqlTemplates
Expand All @@ -108,7 +108,7 @@ public SqliteTriggerTemplate(AbstractSymmetricDialect symmetricDialect) {
+ " values( \n" + " '$(targetTableName)', \n" + " 'R', \n"
+ " $(triggerHistoryId), \n" + " $(oldKeys), \n"
+ " $(channelExpression), null," + sourceNodeExpression + ", \n" + " $(externalSelect), \n"
+ " strftime('%Y-%m-%d %H:%M:%f','now') \n" + " ); \n"
+ " strftime('%Y-%m-%d %H:%M:%f','now','localtime') \n" + " ); \n"
+ " $(custom_on_update_text) \n"
+ "end ");
sqlTemplates
Expand All @@ -121,7 +121,7 @@ public SqliteTriggerTemplate(AbstractSymmetricDialect symmetricDialect) {
+ " values( \n" + " '$(targetTableName)', \n" + " 'D', \n"
+ " $(triggerHistoryId), \n" + " $(oldKeys), \n"
+ " $(oldColumns), \n" + " $(channelExpression), null," + sourceNodeExpression + ", \n"
+ " $(externalSelect), \n" + " strftime('%Y-%m-%d %H:%M:%f','now') \n" + " ); \n"
+ " $(externalSelect), \n" + " strftime('%Y-%m-%d %H:%M:%f','now','localtime') \n" + " ); \n"
+ " $(custom_on_delete_text) \n"
+ "end");
sqlTemplates.put("initialLoadSqlTemplate",
Expand Down

0 comments on commit b3d03fe

Please sign in to comment.