kimmking edited a comment on issue #5173: UUID is configured, but SNOWFLAKE is 
used
URL: 
https://github.com/apache/incubator-shardingsphere/issues/5173#issuecomment-613272052
 
 
   It's correct in my test using your sql&config.
   I think you can try 4.0.1 version.
   
   
![image](https://user-images.githubusercontent.com/807508/79197086-c3cbd900-7e63-11ea-995d-3e1f638cd940.png)
   
   ```
   CREATE TABLE `u0`  (
     `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 
COMMENT '编号',
     `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 
COMMENT '名字',
     `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
     `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '更新时间',
     PRIMARY KEY (`code`) USING BTREE
   ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 
'编码和名字对应表(测试UUID主键)' ROW_FORMAT = Dynamic;
   
   CREATE TABLE `u1`  (
     `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 
COMMENT '编号',
     `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 
COMMENT '名字',
     `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
     `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '更新时间',
     PRIMARY KEY (`code`) USING BTREE
   ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 
'编码和名字对应表(测试UUID主键)' ROW_FORMAT = Dynamic;
   ```
   
   ```
   shardingRule:
     tables:
       u:
         actualDataNodes: test.u${0..1}
         tableStrategy:
           inline:
             shardingColumn: code
             algorithmExpression: u${Math.abs(code.hashCode() % 2)}
         keyGenerator:
           type: UUID
           column: code
   ```
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to