fix reset_check_constraint_of_placeholders
This commit is contained in:
parent
fa55ac017d
commit
5bcf3b2a63
|
@ -521,22 +521,22 @@ class NewDeviceForm(FlaskForm):
|
|||
error = ["Not a correct value"]
|
||||
is_valid = super().validate(extra_validators)
|
||||
|
||||
if self.weight.data and not (0.1 <= self.weight.data):
|
||||
if self.weight.data and not (0.1 <= self.weight.data) or self.weight.data == 0:
|
||||
txt = ["Supported values greater than 0.1"]
|
||||
self.weight.errors = txt
|
||||
is_valid = False
|
||||
|
||||
if self.height.data and not (0.1 <= self.height.data):
|
||||
if self.height.data and not (0.1 <= self.height.data) or self.height.data == 0:
|
||||
txt = ["Supported values greater than 0.1"]
|
||||
self.height.errors = txt
|
||||
is_valid = False
|
||||
|
||||
if self.width.data and not (0.1 <= self.width.data):
|
||||
if self.width.data and not (0.1 <= self.width.data) or self.width.data == 0:
|
||||
txt = ["Supported values greater than 0.1"]
|
||||
self.width.errors = txt
|
||||
is_valid = False
|
||||
|
||||
if self.depth.data and not (0.1 <= self.depth.data):
|
||||
if self.depth.data and not (0.1 <= self.depth.data) or self.depth.data == 0:
|
||||
txt = ["Supported values greater than 0.1"]
|
||||
self.depth.errors = txt
|
||||
is_valid = False
|
||||
|
|
|
@ -23,18 +23,29 @@ def get_inv():
|
|||
|
||||
|
||||
def upgrade():
|
||||
sql = "select constraint_name from information_schema.table_constraints "
|
||||
sql += "where table_name='device' and constraint_type='CHECK';"
|
||||
con = op.get_bind()
|
||||
constraints = []
|
||||
for c in con.execute(sql):
|
||||
constraints.append(c.constraint_name)
|
||||
if 'device_depth_check' in constraints:
|
||||
op.drop_constraint(
|
||||
'device_depth_check', "device", type_="check", schema=f'{get_inv()}'
|
||||
)
|
||||
if 'device_height_check' in constraints:
|
||||
op.drop_constraint(
|
||||
'device_height_check', "device", type_="check", schema=f'{get_inv()}'
|
||||
)
|
||||
if 'device_width_check' in constraints:
|
||||
op.drop_constraint(
|
||||
'device_width_check', "device", type_="check", schema=f'{get_inv()}'
|
||||
)
|
||||
if 'device_weight_check' in constraints:
|
||||
op.drop_constraint(
|
||||
'device_weight_check', "device", type_="check", schema=f'{get_inv()}'
|
||||
)
|
||||
|
||||
op.create_check_constraint(
|
||||
"device_depth_check",
|
||||
"device",
|
||||
|
|
Reference in New Issue