Skip to content

Commit

Permalink
Add comment to explain why do we need to set a NotNull constraint 'ma…
Browse files Browse the repository at this point in the history
…nually'
  • Loading branch information
gacarrillor committed Jul 4, 2020
1 parent 2e09e30 commit f57842f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions QgisModelBaker/libqgsprojectgen/dataobjects/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ def create(self, layer):
default_value = QgsDefaultValue(self.default_value_expression)
layer.layer.setDefaultValueDefinition(field_idx, default_value)

# Additionally, some DB engines like MSSQL require NotNull constraints being set explicitly
if self.mandatory:
layer.layer.setFieldConstraint(field_idx, QgsFieldConstraints.ConstraintNotNull)

0 comments on commit f57842f

Please sign in to comment.