peewee_migrate2
peewee_migrate2 copied to clipboard
Add constraints
Hi,
Is it possible to add the constraints? I have in my model :
class Test(BaseModel): id = PrimaryKeyField(unique=True) quantity = IntegerField(constraints=[Check('quantity > 0')])
And in my migration :
class Test(BaseModel): id = PrimaryKeyField(unique=True) quantity = IntegerField()
My constraint is ignored by the migration module.
Thanks.
Hi. Sure, i will check it
Thanks,
Another alternative for setting constraints is as follows:
class Test(BaseModel): -id = PrimaryKeyField(unique=True) -quantity = IntegerField() -class Meta: --constraints = [Check('quantity > 0')]