sql2dbml fail to generate note if dbo specified

未关闭
#489 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@huydo862003 已经在做这个了。

开始于 2025年11月6日。

评估

这个 Issue 还没有评估数据。

描述

bug

Hi,

When you explicitly specify the dbo schema in front of the table, if comments are added to a column with EXEC sp_addextendedproperty (by specifying the dbo schema), these will not appear in the "note" of the columns concerned in the generated dbml via sql2dbml

Let's take the DDL noschema_specified_is_OK.sql

>>> cat ok.sql
CREATE TABLE mytable(
 a int
)
GO

EXEC sp_addextendedproperty
@name = N'Column_Description',
@value = 'This is the description of my column',
@level0type = N'Schema', @level0name = 'dbo',
@level1type = N'Table', @level1name = 'mytable',
@level2type = N'Column', @level2name = 'a'
GO

>>> sql2dbml --mssql noschema_specified_is_OK.sql
Table "mytable" {
  "a" int [note: 'This is the description of my column']
}

All is fine here.

Now try with specified_schema_is_OK.sql

>>> cat specified_schema_is_OK.sql
CREATE TABLE myschema.mytable(
 a int
)
GO

EXEC sp_addextendedproperty
@name = N'Column_Description',
@value = 'This is the description of my column',
@level0type = N'Schema', @level0name = 'myschema',
@level1type = N'Table', @level1name = 'mytable',
@level2type = N'Column', @level2name = 'a'
GO

>>> sql2dbml --mssql specified_schema_is_OK.sql
Table "myschema"."mytable" {
  "a" int [note: 'This is the description of my column']
}

All is fine here.

Now try with replacing myschema by dbo in file specified_dbo_is_NOK.sql

>>> cat specified_dbo_is_NOK.sql
CREATE TABLE dbo.mytable(
 a int
)
GO

EXEC sp_addextendedproperty
@name = N'Column_Description',
@value = 'This is the description of my column',
@level0type = N'Schema', @level0name = 'dbo',
@level1type = N'Table', @level1name = 'mytable',
@level2type = N'Column', @level2name = 'a'
GO

>>> sql2dbml --mssql specified_dbo_is_NOK.sql
Table "dbo"."mytable" {
  "a" int
}

In this case, there is a problem, the note corresponding to column's a comment doesn't appears

>>>sql2dbml --version
3.0.0
主要语言
JavaScript
星标
3.7k
派生
233
平均合并
2 天 4 小时
30 天内合并 PR
23

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

holistics/dbml 的其他 Issue

查看 holistics/dbml 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。