-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exceptions if slug field not exists or its length is NULL #44
base: 1.next
Are you sure you want to change the base?
Conversation
The exception if the DB field is missing is mostly a "in your face" notice for the developer. The slug field should always have a fixed length. If it doesn't there might be problems with different DB systems / configs using different default lengths.
The changes look like an improvement to me. Haven't played with TravisCI in a while. @ADmad maybe you can quickly spot why some tests are failing? I see some CS related stuff but other are for Pgsql? |
I wonder if there's a use case where someone wants to set the slug to an entity property which doesn't map to a db field. @jadb Travis now requires mysql and postgres to be explicitly enabled using |
@ADmad there are plenty of ways this can happen.
I prefer robust code and exception messages that slap the cause in my face over saving propbably less than a microsecond CPU time by not executing the additional check. |
@burzum I am not denying the usefulness of these explicit checks. My concern is adding check for table columns means one can't use the behavior to assign the slug to a virtual property, so I was wondering if there might be someone out there with such a use case. |
I agree with @ADmad. While I don't have such a use case in mind, I do have a suggestion for a solution. Adding What do you guys think? |
@jadb Sounds good. |
Codecov Report
@@ Coverage Diff @@
## 1.next #44 +/- ##
============================================
- Coverage 98.58% 96.12% -2.46%
- Complexity 59 62 +3
============================================
Files 3 3
Lines 141 155 +14
============================================
+ Hits 139 149 +10
- Misses 2 6 +4 Continue to review full report at Codecov.
|
MySQL seems to default the length even when not defined, Postgres no.
The exception if the DB field is missing is mostly a "in your face" notice for the developer.
The slug field should always have a fixed length. If it doesn't there might be problems with different DB systems / configs using different default lengths.