Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reveng: Generate Table and Column descriptions from database (extend DatabaseModel) #16305

Closed
ErikEJ opened this issue Jun 27, 2019 · 6 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-enhancement
Milestone

Comments

@ErikEJ
Copy link
Contributor

ErikEJ commented Jun 27, 2019

Related to #15037

@ErikEJ ErikEJ changed the title Reveng: Generate Table and Column descrptions from database (extend DatabaseModel) Reveng: Generate Table and Column descriptions from database (extend DatabaseModel) Jun 29, 2019
@ajcvickers
Copy link
Contributor

@ErikEJ Is this something you are interested in sending a PR for?

@ajcvickers ajcvickers added this to the Backlog milestone Jun 29, 2019
@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jun 29, 2019

Yes!

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jun 29, 2019

I propose to extend

Microsoft.EntityFrameworkCore.Scaffolding.Metadata.DatabaseTable 

and

  Microsoft.EntityFrameworkCore.Scaffolding.Metadata.DatabaseColumn

with a Comment property. How does that sound?

@ajcvickers
Copy link
Contributor

Sounds good.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jun 30, 2019


SELECT 
SCH.name + '.' + TBL.name AS CommentKey
,SEP.value AS Comment
FROM sys.tables TBL
 INNER JOIN sys.schemas SCH
 ON TBL.schema_id = SCH.schema_id 
 INNER JOIN sys.extended_properties SEP
 ON TBL.object_id = SEP.major_id 
WHERE SEP.class = 1 
 AND SEP.minor_id = 0
 AND (SEP.value <> '1' AND SEP.value <> 1)
 AND SEP.name = 'MS_Description'

UNION

SELECT 
SCH.name + '.' + TBL.name AS CommentKey
,SEP.value AS Comment
FROM sys.views TBL
 INNER JOIN sys.schemas SCH
 ON TBL.schema_id = SCH.schema_id 
 INNER JOIN sys.extended_properties SEP
 ON TBL.object_id = SEP.major_id 
WHERE SEP.class = 1 
 AND SEP.minor_id = 0
 AND (SEP.value <> '1' AND SEP.value <> 1)
 AND SEP.name = 'MS_Description'

UNION

SELECT 
SCH.name + '.' + TBL.name + '.' + COL.name AS CommentKey
,SEP.value AS Comment
FROM sys.extended_properties SEP
 INNER JOIN sys.columns COL
 ON SEP.major_id = COL.object_id 
 AND SEP.minor_id = COL.column_id 
 INNER JOIN sys.tables TBL
 ON SEP.major_id = TBL.object_id 
 INNER JOIN sys.schemas SCH
 ON TBL.schema_id = SCH.schema_id
WHERE SEP.class = 1
 AND (SEP.value <> '1' AND SEP.value <> 1)

UNION

SELECT 
SCH.name + '.' + TBL.name + '.' + COL.name AS CommentKey
,SEP.value AS Comment
FROM sys.extended_properties SEP
 INNER JOIN sys.columns COL
 ON SEP.major_id = COL.object_id 
 AND SEP.minor_id = COL.column_id 
 INNER JOIN sys.views TBL
 ON SEP.major_id = TBL.object_id 
 INNER JOIN sys.schemas SCH
 ON TBL.schema_id = SCH.schema_id
WHERE SEP.class = 1
 AND (SEP.value <> '1' AND SEP.value <> 1)

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jun 30, 2019

  • Extend databasemodel
  • Get Comment from SQL Server MS_Description
  • Scaffold HasComment()

@bricelam bricelam self-assigned this Jul 18, 2019
@bricelam bricelam added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 18, 2019
@bricelam bricelam modified the milestones: Backlog, 3.0.0 Jul 18, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview8 Jul 29, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview8, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants