Opened 3 months ago

Last modified 3 months ago

#28407 new New feature

Allow inspectdb to introspect db column comments

Reported by: 007gzs Owned by: nobody
Component: Database layer (models, ORM) Version: 1.11
Severity: Normal Keywords: db comment
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by 007gzs)

when use inspectdb make model from db.
the db column is created by dba, not developer .
so db column comments set to models Field is helpful for developer.
like

field = models.IntegerField(blank=True, null=True) #comments in db

https://github.com/django/django/pull/8770

Change History (4)

comment:1 Changed 3 months ago by 007gzs

Description: modified (diff)

comment:2 Changed 3 months ago by Tim Graham

Has patch: set
Needs tests: set
Summary: add db column comments to models Field comment_noteAllow inspectdb to introspect db column comments
Triage Stage: UnreviewedAccepted

I think the comment should be prefixed with something like Column comment: . Also tests are required.

comment:3 Changed 3 months ago by 007gzs

sorry i donot know how can i add a db with comment in tests.

comment:4 Changed 3 months ago by Tim Graham

I think it would involve something like adding a BaseDatabaseSchemaEditor.sql_create_column_comment attribute with the SQL for creating a column comment. Then the test can use that.

Note: See TracTickets for help on using tickets.
Back to Top