逆向工程师MySQL WWorkBench具有计算(生成)字段

发布于 2025-02-07 11:47:10 字数 905 浏览 3 评论 0原文

尝试将工程师作为模式与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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葬シ愛 2025-02-14 11:47:10

它行不通。您必须删除生成的列以在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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文