[dbmanager] don't ignore field modifiers (e.g. length or geometry

definition) when updating it (fix #27613)
This commit is contained in:
Alexander Bruy 2019-09-22 14:10:56 +03:00 committed by Nyall Dawson
parent 2a29c152a9
commit cebdc8dded
2 changed files with 5 additions and 8 deletions

View File

@ -1179,7 +1179,6 @@ class TableField(TableSubItemObject):
if self.default2String() == new_default_str: if self.default2String() == new_default_str:
new_default_str = None new_default_str = None
if self.comment == new_comment: if self.comment == new_comment:
# Update also a new_comment
new_comment = None new_comment = None
ret = self.table().database().connector.updateTableColumn((self.table().schemaName(), self.table().name), ret = self.table().database().connector.updateTableColumn((self.table().schemaName(), self.table().name),
self.name, new_name, new_type_str, self.name, new_name, new_type_str,

View File

@ -71,15 +71,13 @@ class DlgFieldProperties(QDialog, Ui_Dialog):
fld.notNull = not self.chkNull.isChecked() fld.notNull = not self.chkNull.isChecked()
fld.default = self.editDefault.text() fld.default = self.editDefault.text()
fld.hasDefault = fld.default != "" fld.hasDefault = fld.default != ""
# Get the comment from the LineEdit
fld.comment = self.editCom.text() fld.comment = self.editCom.text()
try: # length field also used for geometry definition, so we should
modifier = int(self.editLength.text()) # not cast its value to int
except ValueError: if self.editLength.text() != "":
ok = False fld.modifier = self.editLength.text()
else: else:
ok = True fld.modifier = None
fld.modifier = modifier if ok else None
return fld return fld
def onOK(self): def onOK(self):