CheckColumns Constraint (#730)
* feat: add check columns class * feat: write document of check columns part * test: write a test for check columns constraints * fix: debuging test exception raise mysql * fix: set pragma no cover to ignore cov * fix: ignore pytest raise in python 3.x not 10 * feat: set constraint name for check columns * refactor: support index and check overwrites * fix: debuging check constraint arguments * fix: debug coverage all code tests * fix: pass the map of type constraint to counter * refactor: edit check name replace sapce underline * refactor: write new function copy constraints * test: write test for invalid constraint type * fix: debug text cluase replaced names * fix: set pragma no cover for result returned * refactor: no coverage for main if statement * perf: change get constraint copy func code * fix: fix bug in mypy typing check
This commit is contained in:
@ -429,6 +429,17 @@ You can set this parameter by providing `Meta` class `constraints` argument.
|
||||
To set one column index use [`unique`](../fields/common-parameters.md#index) common parameter.
|
||||
Of course, you can set many columns as indexes with this param but each of them will be a separate index.
|
||||
|
||||
#### CheckColumns
|
||||
|
||||
You can set this parameter by providing `Meta` class `constraints` argument.
|
||||
|
||||
```Python hl_lines="14-17"
|
||||
--8<-- "../docs_src/models/docs018.py"
|
||||
```
|
||||
|
||||
!!!note
|
||||
Note that some databases do not actively support check constraints such as MySQL.
|
||||
|
||||
|
||||
### Pydantic configuration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user