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:
Sepehr Bazyar
2022-07-14 12:35:30 +04:30
committed by GitHub
parent 3ad563e5dd
commit b6e057c303
9 changed files with 160 additions and 10 deletions

View File

@ -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