逆向工程师MySQL WWorkBench具有计算(生成)字段
尝试将工程师作为模式与MySQL Workbench进行反向工程的尝试失败了以下错误:
16:06:46 [ERR][ grt]: (127, 53) "GENERATED" is not valid at this position, expecting ')'
16:06:46 [ERR][ grt]: (149, 53) "GENERATED" is not valid at this position, expecting ')'
原因是以下表:
CREATE TABLE IF NOT EXISTS `student` (
`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`Firstname` varchar(255) NOT NULL,
`Fullname` varchar(250) GENERATED ALWAYS AS (concat_ws(' ',`Firstname`,`Name`)) VIRTUAL,
PRIMARY KEY (`ID`)
);
我如何
CREATE TABLE IF NOT EXISTS `teacher` (
`Abbr` char(3) NOT NULL,
`Name` varchar(255) NOT NULL,
`Firstname` varchar(255) NOT NULL,
`FullName` varchar(255) GENERATED ALWAYS AS (concat_ws(' ',`Firstname`,`Name`)) VIRTUAL,
PRIMARY KEY (`Abbr`)
);
反向工程师一个可以包含生成属性的架构?
Attempts to reverse engineer as schema with MySQL Workbench fail with the following error:
16:06:46 [ERR][ grt]: (127, 53) "GENERATED" is not valid at this position, expecting ')'
16:06:46 [ERR][ grt]: (149, 53) "GENERATED" is not valid at this position, expecting ')'
The reason for this are the following tables:
CREATE TABLE IF NOT EXISTS `student` (
`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`Firstname` varchar(255) NOT NULL,
`Fullname` varchar(250) GENERATED ALWAYS AS (concat_ws(' ',`Firstname`,`Name`)) VIRTUAL,
PRIMARY KEY (`ID`)
);
and
CREATE TABLE IF NOT EXISTS `teacher` (
`Abbr` char(3) NOT NULL,
`Name` varchar(255) NOT NULL,
`Firstname` varchar(255) NOT NULL,
`FullName` varchar(255) GENERATED ALWAYS AS (concat_ws(' ',`Firstname`,`Name`)) VIRTUAL,
PRIMARY KEY (`Abbr`)
);
How do I reverse engineer a schema which relations can contain generated attributes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它行不通。您必须删除生成的列以在MySQL Workbench中进行反向工程。
据报道这是2018年的错误: https://bugs.mysqs.mysql.com/bug.com/bug.com/bug.com/bug.com/bug.com/bug .php?id = 92267
恐怕MySQL Workbench的改进资源很差,并且它落后于MySQL Server的几个功能。我还发现,如果您将表达式用作列的
默认
,则反向工程师功能无效。为了制作图表,我必须对数据库进行特殊的测试实例,更改具有表达式默认值的表,然后执行反向工程的步骤。我建议您必须这样做 - 制作一个特殊实例并删除生成的列。
It doesn't work. You have to remove the generated columns to do reverse engineer in MySQL Workbench.
This was reported as a bug in 2018: https://bugs.mysql.com/bug.php?id=92267
I'm afraid MySQL Workbench gets poor resources for improvement, and it has fallen behind several features of MySQL Server. I also discovered the reverse engineer feature doesn't work if you use an expression as the
DEFAULT
of a column.To make my diagram, I had to make a special test instance of my database, alter the tables that had expression defaults, and then do the reverse engineer step. I suggest you will have to do the same — make a special instance and remove your generated columns.