Skip to content
Permalink
Browse files

DB manager fix add comment while creating table

Fixes #38394
  • Loading branch information
elpaso committed Sep 25, 2020
1 parent 04ae0ca commit eb3c78d12df9e45d91df8706c6e09cadf0773149
@@ -301,7 +301,7 @@ def getObject(self, row):

fld.notNull = self.data(self.index(row, 2), Qt.CheckStateRole) == Qt.Unchecked
fld.primaryKey = self.data(self.index(row, 1), Qt.UserRole)
fld.comment = self.data(self.index(row, 4), Qt.UserRole)
fld.comment = self.data(self.index(row, 4))
return fld

def getFields(self):
@@ -585,6 +585,13 @@ def createTable(self, table, fields, schema=None):

ret = self.connector.createTable((schema, table), field_defs, pk_name)
if ret is not False:
# Add comments if any, because definition does not include
# the comment
for f in fields:
if f.comment:
self.connector.updateTableColumn(
(schema, table), f.name, comment=f.comment
)
self.refresh()
return ret

0 comments on commit eb3c78d

Please sign in to comment.
You can’t perform that action at this time.