| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I think that a column is not the right place for a unique constraint. And there can be more than one unique constraints for a table. The natural representation for a unique constraint is a list of columns. And a unique constraint should have a name. |
Sorry, something went wrong.
|
I think a column can perfectly be the right place for a unique constraint, if the unicity constraint is on one column only. The possibility to create constraints on multiple columns should of course exist as well, but adding a nameless unique constraint to a single column is a pretty common use case. And it seems people from postgresql agree : https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS. |
Sorry, something went wrong.
|
Hi @christophelec! I would also set index to False if Undefined (which is the SQLAlchemy's default) so that a UNIQUE CONSTRAINT clause be included in the column definition. Otherwise, an index with unique=True will be generated. |
Sorry, something went wrong.
|
Any updates? |
Sorry, something went wrong.
Waiting the merge. |
Sorry, something went wrong.
|
Awesome! Thanks for writing thorough tests @raphaelgibson! 🚀 🙇 🍰 This will be available in SQLModel 0.0.7, released in the next hours. 🎉 |
Sorry, something went wrong.
|
📝 Docs preview for commit c2c6670 at: https://630aacc9a5277f58b9062b3e--sqlmodel.netlify.app |
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## main #83 +/- ##
==========================================
+ Coverage 97.70% 97.72% +0.02%
==========================================
Files 185 186 +1
Lines 6133 6203 +70
==========================================
+ Hits 5992 6062 +70
Misses 141 141
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Add unique constraint param to Field function to create unique columns.
I have added tests for these modifications.